public async Task <IActionResult> PutSeat(string id, [FromBody] Seat seat) { if (id != seat.Id) { return(BadRequest()); } _context.Entry(seat).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SeatExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Register([FromBody] User user) { User entity = await GetUserByEmail(user.Email); if (entity != null) { return(BadRequest("Email is already associated with an account")); } _context.Users.Add(user); await _context.SaveChangesAsync(); return(Ok(user.Id)); }