Пример #1
0
 public void CreateOrder(OrderCreationDTO order)
 {
     if (dateTimeValidation.DateTimeValidation(order))
     {
         throw new DateIsBusyExeption();
     }
     DataAccessLayer.OrderRepos.Create(mapper.Map <OrderCreationDTO, Order>(order));
 }
        public ActionResult PlaceOrder(Guid id, [FromBody] OrderCreationDTO order)
        {
            Console.WriteLine(order);
            var EntityOrder = _mapper.Map <Order>(order);

            _repository.AddOrder(EntityOrder, id);
            _repository.save();
            return(Ok());
        }
Пример #3
0
        public IEnumerable <OrderCreationDTO> GetDateTimeOverlay(OrderCreationDTO item)
        {
            List <OrderDTO> orders = new List <OrderDTO>(GetOrderByRoomId(item.RoomId));

            return(mapper.Map <IEnumerable <OrderDTO>, IEnumerable <OrderCreationDTO> >(
                       orders.FindAll(
                           order => (order.Arrival <= item.Arrival && order.Departure > item.Arrival) ||
                           (order.Arrival < item.Departure && order.Departure > item.Departure)
                           )
                       ));
        }
Пример #4
0
 public async Task CreateOrderAsync(OrderCreationDTO order)
 {
     if (!await dateTimeValidation.DateTimeValidationAsync(order))
     {
         throw new DateIsBusyExeption();
     }
     else
     {
         await DataAccessLayer.OrderRepos.CreateAsync(mapper.Map <OrderCreationDTO, Order>(order));
     }
 }
Пример #5
0
        bool IDateTimeValidation.DateTimeValidation(OrderCreationDTO item)
        {
            List <OrderDTO> orders = new List <OrderDTO>(GetOrderByRoomId(item.RoomId));

            if (orders == null)
            {
                return(false);
            }
            return(orders.Exists(
                       order => (order.Arrival <= item.Arrival && order.Departure > item.Arrival) ||
                       (order.Arrival < item.Departure && order.Departure > item.Departure)
                       ));
        }
Пример #6
0
        public async Task <ActionResult> Post([FromBody] OrderCreationDTO orderCreationDTO)
        {
            var order = mapper.Map <Order>(orderCreationDTO);

            if (order == null)
            {
                return(BadRequest());
            }
            order.userid = context.tblOrder.Max(x => x.userid) + 1;
            context.Add(order);
            await context.SaveChangesAsync();

            var orderDTO = mapper.Map <OrderDTO>(order);

            return(new CreatedAtRouteResult("getOrder", new { id = orderDTO.order_id }, orderDTO));
        }
Пример #7
0
 public void CreateOrder([FromBody] OrderCreationDTO order)
 {
     BusinesLogic.OrderService.CreateOrder(order);
 }
Пример #8
0
 public Task <IEnumerable <OrderCreationDTO> > GetDateTimeOverlayAsync(OrderCreationDTO item)
 {
     throw new NotImplementedException();
 }
Пример #9
0
 public Task <bool> DateTimeValidationAsync(OrderCreationDTO item)
 {
     throw new NotImplementedException();
 }