added GameGenre

This commit is contained in:
Luke Pulverenti
2013-07-01 13:17:33 -04:00
parent 1d7c83bfc6
commit 57449f62c1
15 changed files with 503 additions and 3 deletions

View File

@@ -53,6 +53,14 @@ namespace MediaBrowser.Api
public string GenreName { get; set; }
}
[Route("/GameGenres/{GenreName}", "POST")]
[Api(("Updates a game genre"))]
public class UpdateGameGenre : BaseItemDto, IReturnVoid
{
[ApiMember(Name = "GenreName", Description = "The name of the item", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public string GenreName { get; set; }
}
[Route("/Genres/{GenreName}", "POST")]
[Api(("Updates a genre"))]
public class UpdateGenre : BaseItemDto, IReturnVoid
@@ -152,6 +160,22 @@ namespace MediaBrowser.Api
await _libraryManager.UpdateItem(item, ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
}
public void Post(UpdateGameGenre request)
{
var task = UpdateItem(request);
Task.WaitAll(task);
}
private async Task UpdateItem(UpdateGameGenre request)
{
var item = await _libraryManager.GetGameGenre(request.GenreName).ConfigureAwait(false);
UpdateItem(request, item);
await _libraryManager.UpdateItem(item, ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
}
public void Post(UpdateGenre request)
{
var task = UpdateItem(request);