diff --git a/server/AyaNova/Controllers/DashboardViewController.cs b/server/AyaNova/Controllers/DashboardViewController.cs index cda0d591..a54a965e 100644 --- a/server/AyaNova/Controllers/DashboardViewController.cs +++ b/server/AyaNova/Controllers/DashboardViewController.cs @@ -46,12 +46,12 @@ namespace AyaNova.Api.Controllers /// - /// Get full DashboardView object + /// Get DashboardView object for current User + /// There is always one for each user /// - /// - /// A single DashboardView - [HttpGet("{id}")] - public async Task GetDashboardView([FromRoute] long id) + /// Dashboard view + [HttpGet()] + public async Task GetDashboardView() { if (!serverState.IsOpen) return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); @@ -76,13 +76,12 @@ namespace AyaNova.Api.Controllers /// - /// Put (update) DashboardView - /// - /// + /// Put (update) logged in User's Dashboard view + /// /// /// - [HttpPut("{id}")] - public async Task PutDashboardView([FromRoute] long id, [FromBody] DashboardView inObj) + [HttpPut()] + public async Task 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)); diff --git a/server/AyaNova/biz/DashboardViewBiz.cs b/server/AyaNova/biz/DashboardViewBiz.cs index 7777e242..c44274e1 100644 --- a/server/AyaNova/biz/DashboardViewBiz.cs +++ b/server/AyaNova/biz/DashboardViewBiz.cs @@ -35,9 +35,9 @@ namespace AyaNova.Biz //////////////////////////////////////////////////////////////////////////////////////////////// //EXISTS - internal async Task ExistsAsync(long id) + internal async Task ExistsAsync() { - return await ct.DashboardView.AnyAsync(z => z.Id == id); + return await ct.DashboardView.AnyAsync(z => z.UserId == UserId); }