Exemplo n.º 1
0
        public ContentResult Post([FromBody] object reservationDTO)
        {
            object reservation = ReservationMapping.MapDTOToDomainObject(reservationDTO);

            _logger.LogInformation("Reservation created ," + DateTime.UtcNow);
            object returnedReservation = enrichmentService.Add(reservation);

            if (returnedReservation != null)
            {
                return new ContentResult()
                       {
                           Content     = JsonConvert.SerializeObject(ReservationMapping.MapDomainToDTOObject(returnedReservation)),
                           ContentType = "application/json",
                           StatusCode  = 200
                       }
            }
            ;

            else
            {
                return new ContentResult()
                       {
                           StatusCode = 412
                       }
            };
        }
Exemplo n.º 2
0
 public object Get(string id)
 {
     return(ReservationMapping.MapDomainToDTOObject(enrichmentService.Get(id)));
 }