public async Task <ActionResult <SessionResponse> > Post(EventDTO.Session input) { var session = new Data.Session { Title = input.Title, ConferenceID = input.ConferenceID, StartTime = input.StartTime, EndTime = input.EndTime, Abstract = input.Abstract, TrackId = input.TrackId }; _db.Sessions.Add(session); await _db.SaveChangesAsync(); var result = session.MapSessionResponse(); return(CreatedAtAction(nameof(Get), new { id = result.ID }, result)); }
public async Task <IActionResult> Put(int id, EventDTO.Session input) { var session = await _db.Sessions.FindAsync(id); if (session == null) { return(NotFound()); } session.ID = input.ID; session.Title = input.Title; session.Abstract = input.Abstract; session.StartTime = input.StartTime; session.EndTime = input.EndTime; session.TrackId = input.TrackId; session.ConferenceID = input.ConferenceID; await _db.SaveChangesAsync(); return(NoContent()); }