public async Task <ActionResult <ConferenceResponse> > GetConference(int id)
        {
            var conference = await _conferencesRepository.GetByIdAsync(id);

            if (conference == null)
            {
                return(NotFound());
            }

            return(conference.MapConferenceResponse());
        }
Exemple #2
0
        public async Task <ActionResult <AttendeeResponse> > AddConference(string username, int conferenceId)
        {
            var attendee = await _attendeesRepository.GetByUsernameAsync(username);

            if (attendee == null)
            {
                return(NotFound());
            }

            var conference = await _conferencesRepository.GetByIdAsync(conferenceId);

            if (conference == null)
            {
                return(BadRequest());
            }

            var newAttendee = await _attendeesRepository.AddConferenceAsync(username, conferenceId);

            return(newAttendee.MapAttendeeResponse());
        }