public async Task<IActionResult> PutSessionAttendees(int id, SessionAttendees sessionAttendees) { if (id != sessionAttendees.UserId) { return BadRequest(); } _context.Entry(sessionAttendees).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SessionAttendeesExists(id)) { return NotFound(); } else { throw; } } return NoContent(); }
public async Task<ActionResult<SessionAttendees>> PostSessionAttendees(SessionAttendees sessionAttendees) { _context.SessionAttendees.Add(sessionAttendees); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (SessionAttendeesExists(sessionAttendees.UserId)) { return Conflict(); } else { throw; } } return CreatedAtAction("GetSessionAttendees", new { id = sessionAttendees.UserId }, sessionAttendees); }