public async Task <IActionResult> PutAttendee(int meetingId, int attendeeId, AttendeeRequestViewModel model) { if (attendeeId != model.Id) { return(BadRequest()); } var exists = _meetingRepository.Exists(meetingId); if (false == exists) { return(BadRequest()); } var entity = await _attendeeRepository.GetAsync(model.Id); if (entity == null) { return(NotFound()); } if (meetingId != entity.MeetingId) { return(BadRequest()); } if (null == model.Member) { entity.MemberId = null; entity.Member = null; } else { entity.MemberId = model.Member.Id; entity.Member = model.Member.Name; } _attendeeRepository.Update(entity); try { await _attendeeRepository.CompleteAsync(); } catch (DbUpdateConcurrencyException) { if (!AttendeeExists(attendeeId)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <AttendeeRegistrationResponseDto> > GetAttendeesById(Guid Id) { var item = await attendeeRepository.GetAsync(Id); if (item == null) { return(StatusCode(StatusCodes.Status404NotFound, "Item Not Found")); } return(StatusCode(StatusCodes.Status200OK, item.AsResponseDto())); }