This commit is contained in:
@@ -46,12 +46,12 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get full DashboardView object
|
||||
/// Get DashboardView object for current User
|
||||
/// There is always one for each user
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns>A single DashboardView</returns>
|
||||
[HttpGet("{id}")]
|
||||
public async Task<IActionResult> GetDashboardView([FromRoute] long id)
|
||||
/// <returns>Dashboard view</returns>
|
||||
[HttpGet()]
|
||||
public async Task<IActionResult> GetDashboardView()
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
@@ -76,13 +76,12 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Put (update) DashboardView
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// Put (update) logged in User's Dashboard view
|
||||
/// </summary>
|
||||
/// <param name="inObj"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("{id}")]
|
||||
public async Task<IActionResult> PutDashboardView([FromRoute] long id, [FromBody] DashboardView inObj)
|
||||
[HttpPut()]
|
||||
public async Task<IActionResult> PutDashboardView([FromBody] DashboardView inObj)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
@@ -107,7 +106,7 @@ namespace AyaNova.Api.Controllers
|
||||
}
|
||||
catch (DbUpdateConcurrencyException)
|
||||
{
|
||||
if (!await biz.ExistsAsync(id))
|
||||
if (!await biz.ExistsAsync())
|
||||
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
else
|
||||
return StatusCode(409, new ApiErrorResponse(ApiErrorCode.CONCURRENCY_CONFLICT));
|
||||
|
||||
@@ -35,9 +35,9 @@ namespace AyaNova.Biz
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//EXISTS
|
||||
internal async Task<bool> ExistsAsync(long id)
|
||||
internal async Task<bool> ExistsAsync()
|
||||
{
|
||||
return await ct.DashboardView.AnyAsync(z => z.Id == id);
|
||||
return await ct.DashboardView.AnyAsync(z => z.UserId == UserId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user