コード例 #1
0
        public async Task <ActionResult <MeetingDto> > Get(int id)
        {
            try
            {
                var result = await meetingService.GetAsync(id);

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

                MeetingDto meeting = new MeetingDto
                {
                    Id           = result.Id,
                    Topic        = result.Topic,
                    Date         = result.Date.Value.ToString("d"),
                    DateTime     = result.Date,
                    StartTime    = result.Date.Value.ToString("HH:mm"),
                    EndTime      = result.EndTime,
                    Participants = result.Participants.Select(y => new ParticipantDto {
                        Id = y.Id, Fullname = y.Fullname
                    }).ToArray()
                };

                return(meeting);
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, "Database Failure"));
            }
        }