/// <summary> /// /// </summary> /// <remarks>Updates a rental request rotation list entry. Side effect is the LocalAreaRotationList is also updated</remarks> /// <param name="id">id of RentalRequest to update</param> /// <param name="rentalRequestRotationListId">id of RentalRequestRotationList to update</param> /// <param name="item"></param> /// <response code="200">OK</response> /// <response code="404">RentalRequestRotationList not found</response> public virtual IActionResult RentalrequestsIdRentalrequestrotationlistRentalRequestRotationListIdPutAsync(int id, int rentalRequestRotationListId, RentalRequestRotationList item) { // update the rental request rotation list item. AdjustRRRLRecord(item); var exists = _context.RentalRequestRotationLists.Any(a => a.Id == rentalRequestRotationListId); if (exists && rentalRequestRotationListId == item.Id) { _context.RentalRequestRotationLists.Update(item); // Save the changes _context.SaveChanges(); _context.Entry(item).State = EntityState.Detached; // now update the corresponding entry in the LocalAreaRotationList. _context.UpdateLocalAreaRotationList(item.Id); return(new ObjectResult(item)); } else { // record not found return(new StatusCodeResult(404)); } }