public async Task <IActionResult> PutMeeting(int meetingId, MeetingRequestViewModel model) { var entity = await _meetingRepository.GetAsync(meetingId); if (null == entity) { return(NotFound()); } entity.Date = model.Date; entity.Name = model.Name; entity.Note = model.Note; entity.Cancelled = model.Cancelled; _meetingRepository.Update(entity); try { await _meetingRepository.CompleteAsync(); } catch (DbUpdateConcurrencyException) { if (!MeetingExists(meetingId)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <MeetingViewModel> > PostMeeting(MeetingRequestViewModel model) { var meeting = new Meeting { Date = model.Date, Name = model.Name, Note = model.Note, Cancelled = model.Cancelled }; _meetingRepository.Add(meeting); await _meetingRepository.CompleteAsync(); var attendees = await _attendeeRepository.GetAllWithRolesByMeetingAsync(meeting.Id); var reponse = ViewModelHelper.Convert(meeting, attendees); return(CreatedAtAction("GetMeeting", new { meetingId = meeting.Id }, reponse)); }