예제 #1
0
        public async Task <ActionResult <SessionResponse> > Post(ConferenceDTO.Session input)
        {
            var session = new Data.Session
            {
                Title     = input.Title,
                StartTime = input.StartTime,
                EndTime   = input.EndTime,
                Abstract  = input.Abstract,
                TrackId   = input.TrackId
            };

            _context.Sessions.Add(session);
            await _context.SaveChangesAsync();

            var result = session.MapSessionResponse();

            return(CreatedAtAction(nameof(Get), new { id = result.Id }, result));
        }
예제 #2
0
        public ActionResult <SessionResponse> Post(ConferenceDTO.Session input)
        {
            var session = new Data.Session
            {
                Title        = input.Title,
                ConferenceID = input.ConferenceID,
                StartTime    = input.StartTime,
                EndTime      = input.EndTime,
                Abstract     = input.Abstract,
                TrackId      = input.TrackId
            };

            _db.Sessions.Add(session);
            _db.SaveChangesAsync()
            .GetAwaiter()
            .GetResult();

            var result = session.MapSessionResponse();

            return(CreatedAtAction(nameof(Get), new { id = result.ID }, result));
        }
 private static ConferenceDTO.SessionResponse MapSessionResponse(Data.Session session)
 {
     return(session.MapSessionResponse());
 }