src/fursvp.api/Controllers/EventController.cs
/// <summary>
/// Updates the member's info for an Event.
/// </summary>
/// <param name="eventId">The globally unique identifier for the Event.</param>
/// <param name="memberId">The globally unique identifier for the Event's Member to be updated.</param>
/// <param name="updateMember">The <see cref="UpdateMemberRequest" /> containing member data to be updated.</param>
/// <returns>200 Ok on success, 404 Not Found if either the Event Id or Member Id are not found, or 400 Bad Request if the member is not either attending or an organizer.</returns>
Updates the member's info for an Event.
Updates the member ' s info for an Event .
[HttpPut]
        [Route("{eventId}/member/{memberId}")]
        public async Task<IActionResult> UpdateMember(Guid eventId, Guid memberId, [FromBody] UpdateMemberRequest updateMember)
        {
            if (updateMember == null)
            {
                throw new ArgumentNullException(nameof(updateMember)); 
            }
            var @event = await EventRepositoryRead.GetById(eventId).ConfigureAwait(false);
            if (@event == null)
            {
                return NotFound("Event not found with id " + eventId);
            }
            var member = @event.Members.SingleOrDefault(x => x.Id == memberId);
            if (member == null)
            {
                return NotFound("Member not found with id " + memberId);
            }
            member.IsAttending = updateMember.IsAttending;
            member.IsOrganizer = updateMember.IsOrganizer;
            member.EmailAddress = updateMember.EmailAddress;
            member.Name = updateMember.Name;
            member.Responses.Clear();
            foreach (var response in updateMember.FormResponses)
            {
                member.Responses.Add(response);
            }
            await EventRepositoryWrite.Update(@event).ConfigureAwait(false);
            return Ok(Mapper.MapResponse(@event, DateTimeProvider));
        }
[ HttpPut ] [ Route ( " " ) ] public async Task < IActionResult > UpdateMember ( Guid eventId , Guid memberId , [ FromBody ] UpdateMemberRequest updateMember ) { if ( updateMember == null ) { throw new ArgumentNullException ( nameof ( updateMember ) ) ; } var @event = await EventRepositoryRead . GetById ( eventId ) . ConfigureAwait ( false ) ; if ( @event == null ) { return NotFound ( " " + eventId ) ; } var member = @event . Members . SingleOrDefault ( x => x . Id == memberId ) ; if ( member == null ) { return NotFound ( " " + memberId ) ; } member . IsAttending = updateMember . IsAttending ; member . IsOrganizer = updateMember . IsOrganizer ; member . EmailAddress = updateMember . EmailAddress ; member . Name = updateMember . Name ; member . Responses . Clear ( ) ; foreach ( var response in updateMember . FormResponses ) { member . Responses . Add ( response ) ; } await EventRepositoryWrite . Update ( @event ) . ConfigureAwait ( false ) ; return Ok ( Mapper . MapResponse ( @event , DateTimeProvider ) ) ; }
Updates the member's info for an Event.
Updates the member ' s info for an Event .
200 Ok on success, 404 Not Found if either the Event Id or Member Id are not found, or 400 Bad Request if the member is not either attending or an organizer.
200 Ok on success 404 Not Found if either the Event Id or Member Id are not found or 400 Bad Request if the member is not either attending or an organizer .
eventId
Guid
The globally unique identifier for the Event.
The globally unique identifier for the Event .
memberId
Guid
The globally unique identifier for the Event's Member to be updated.
The globally unique identifier for the Event ' s Member to be updated .
UpdateMemberRequest
[FromBody]
updateMember
The  containing member data to be updated.
The containing member data to be updated .