public async Task <IActionResult> PutOrgan(int id, Organ organ) { if (id != organ.ID) { return(BadRequest()); } _context.Entry(organ).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrganExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <User> > PutUser(int id, User user) { if (id != user.ID) { return(BadRequest()); } _context.Entry(user).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(id)) { return(NotFound()); } else { throw; } } return(user); }
public async Task <ActionResult <UserChoice> > DeleteUserChoice(int id) { var userChoice = await _context.UserChoices.FindAsync(id); if (userChoice == null) { return(NotFound()); } _context.UserChoices.Remove(userChoice); await _context.SaveChangesAsync(); return(userChoice); }