mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
Added more magic to fancy. it now automatically figures our response for PUT and POST based on request ID.
file name sample uses HTTP GET instead of post
This commit is contained in:
parent
438e3199de
commit
4188946395
20 changed files with 135 additions and 198 deletions
|
@ -22,11 +22,11 @@ namespace NzbDrone.Api
|
|||
}
|
||||
|
||||
|
||||
protected TResource ToResource<TModel>(Func<TModel, TModel> function, TResource resource) where TModel : ModelBase, new()
|
||||
protected int GetNewId<TModel>(Func<TModel, TModel> function, TResource resource) where TModel : ModelBase, new()
|
||||
{
|
||||
var model = resource.InjectTo<TModel>();
|
||||
function(model);
|
||||
return model.InjectTo<TResource>();
|
||||
return model.Id;
|
||||
}
|
||||
|
||||
protected List<TResource> ToListResource<TModel>(Func<IEnumerable<TModel>> function) where TModel : ModelBase, new()
|
||||
|
@ -35,17 +35,6 @@ namespace NzbDrone.Api
|
|||
return modelList.InjectTo<List<TResource>>();
|
||||
}
|
||||
|
||||
protected TResource ToResource<TModel>(Func<TModel> function) where TModel : ModelBase, new()
|
||||
{
|
||||
var modelList = function();
|
||||
return modelList.InjectTo<TResource>();
|
||||
}
|
||||
|
||||
protected TResource ToResource<TModel>(Func<int, TModel> action, int id) where TModel : ModelBase, new()
|
||||
{
|
||||
var model = action(id);
|
||||
return model.InjectTo<TResource>();
|
||||
}
|
||||
|
||||
protected PagingResource<TResource> ApplyToPage<TModel>(Func<PagingSpec<TModel>, PagingSpec<TModel>> function, PagingSpec<TModel> pagingSpec) where TModel : ModelBase, new()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue