// PUT: odata/VacationReports(5) /// <summary> /// Not implemented. /// </summary> /// <param name="key"></param> /// <param name="delta"></param> /// <returns></returns> public new IActionResult Put([FromODataUri] int key, Delta <VacationReport> delta) { try { var report = Repo.AsQueryable().FirstOrDefault(x => x.Id == key); if (report == null) { return(StatusCode(StatusCodes.Status404NotFound)); } if (CurrentUser.Id != report.PersonId) { return(StatusCode(StatusCodes.Status403Forbidden)); } _reportService.Edit(delta); return(Updated(report)); } catch (Exception ex) { _logger.LogWarning(ex, "Failed to edit vacation report"); return(StatusCode(StatusCodes.Status400BadRequest, ex)); } }
// PUT: odata/VacationReports(5) /// <summary> /// Not implemented. /// </summary> /// <param name="key"></param> /// <param name="delta"></param> /// <returns></returns> public new IHttpActionResult Put([FromODataUri] int key, Delta <VacationReport> delta) { var report = Repo.AsQueryable().FirstOrDefault(x => x.Id == key); if (report == null) { return(StatusCode(HttpStatusCode.NotFound)); } if (CurrentUser.Id != report.PersonId) { return(StatusCode(HttpStatusCode.Forbidden)); } _reportService.Edit(delta); return(Updated(report)); }