mirror of
https://github.com/hmaxnl/SharpRSS.git
synced 2025-01-18 21:04:21 +01:00
Added api response model
This commit is contained in:
parent
8e6f96c9df
commit
906c234548
|
@ -28,12 +28,15 @@ namespace SharpSyndicationApi.Controllers
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[ProducesResponseType(200, Type = typeof(IEnumerable<Category>))]
|
[ProducesResponseType(200, Type = typeof(IEnumerable<Category>))]
|
||||||
public ActionResult<IEnumerable<Category>> GetCategories()
|
public ActionResult<ApiResponse<IEnumerable<Category>>> GetCategories()
|
||||||
{
|
{
|
||||||
|
ApiResponse<IEnumerable<Category>> response = new ApiResponse<IEnumerable<Category>>();
|
||||||
IEnumerable<Category> categories = _context.Categories.ToList();
|
IEnumerable<Category> categories = _context.Categories.ToList();
|
||||||
if (categories == null || !categories.Any())
|
if (categories == null || !categories.Any())
|
||||||
return NotFound();
|
return NotFound();
|
||||||
return Ok(categories);
|
response.RespsonseData = categories;
|
||||||
|
response.ContinuationToken = "NO_CONTINUATION";
|
||||||
|
return Ok(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
8
SharpSyndicationApi/Models/ApiResponse.cs
Normal file
8
SharpSyndicationApi/Models/ApiResponse.cs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
namespace SharpSyndicationApi.Models
|
||||||
|
{
|
||||||
|
public class ApiResponse <T>
|
||||||
|
{
|
||||||
|
public T RespsonseData { get; set; }
|
||||||
|
public string ContinuationToken { get; set; }
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user