Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jxpxxzj committed Oct 3, 2019
1 parent f3e6f71 commit f2bbc43
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 19 deletions.
19 changes: 0 additions & 19 deletions PrivateCloudMusic/Handlers/AlbumHandler.cs

This file was deleted.

30 changes: 30 additions & 0 deletions PrivateCloudMusic/Handlers/CategoryHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System.Linq;
using System.Threading.Tasks;
using Pcm.Proto;
using Pcm.Proxy;
using Pcm.Services;

namespace Pcm.Handlers
{
public class CategoryHandler
{
public async Task<StatusCode> Get(Context ctx, Request req, Response resp)
{
return await Task.FromResult(StatusCode.Ok);
}

public async Task<StatusCode> List(Context ctx, Request req, Response resp)
{
var musics = MusicService.Instance.Collection.FindAll()
.Select(t => t.ToResp())
.GroupBy(m => m.Album)
.ToDictionary(m => m.Key, m => new ListMusicResponseBody() { Musics = { m.ToList() }});

resp.Body.ListByAlbum = new ListByAlbumResponseBody()
{
Albums = { musics }
};
return await Task.FromResult(StatusCode.Ok);
}
}
}

0 comments on commit f2bbc43

Please sign in to comment.