public async Task <ActionResult <ConferenceResponse> > CreateConference(ConferenceDTO.Conference input) { var conference = await _conferencesRepository.AddAsync(new Data.Conference { Name = input.Name, StartTime = input.StartTime, EndTime = input.EndTime, }); return(CreatedAtAction(nameof(GetConference), new { id = conference.ID }, conference.MapConferenceResponse())); }
public async Task <IActionResult> PutConference(int id, ConferenceDTO.Conference input) { var conference = await _db.FindAsync <Data.Conference>(id); if (conference == null) { return(NotFound()); } conference.Name = input.Name; await _db.SaveChangesAsync(); return(NoContent()); }
public async Task <ActionResult <ConferenceResponse> > CreateConference(ConferenceDTO.Conference input) { var conference = new Data.Conference { Name = input.Name }; _db.Conferences.Add(conference); await _db.SaveChangesAsync(); var result = new ConferenceDTO.ConferenceResponse { ID = conference.ID, Name = conference.Name }; return(CreatedAtAction(nameof(GetConference), new { id = conference.ID }, result)); }