public async Task <IActionResult> PutMember([FromRoute] int id, [FromBody] Member Member) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != Member.id) { return(BadRequest()); } _context.Entry(Member).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MemberExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutPrescribeResource([FromRoute] int id, [FromBody] PrescribeResource prescribeResource) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != prescribeResource.id) { return(BadRequest()); } //Set DateOf AcceptS if (prescribeResource.MemberAccepted) { prescribeResource.MemberAcceptDateOf = DateTime.Now; } _context.Entry(prescribeResource).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PrescribeResourceExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }