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()); }
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) ) )); }
public async Task CreateOrderAsync(OrderCreationDTO order) { if (!await dateTimeValidation.DateTimeValidationAsync(order)) { throw new DateIsBusyExeption(); } else { await DataAccessLayer.OrderRepos.CreateAsync(mapper.Map <OrderCreationDTO, Order>(order)); } }
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) )); }
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)); }
public void CreateOrder([FromBody] OrderCreationDTO order) { BusinesLogic.OrderService.CreateOrder(order); }
public Task <IEnumerable <OrderCreationDTO> > GetDateTimeOverlayAsync(OrderCreationDTO item) { throw new NotImplementedException(); }
public Task <bool> DateTimeValidationAsync(OrderCreationDTO item) { throw new NotImplementedException(); }