public HttpResponseMessage AddOrder([FromBody] OrderReceivedModel data) { string user = User.Identity.GetUserId(); List <OrderDetail> res = (List <OrderDetail>)JsonConvert.DeserializeObject(data.arrayMenu, typeof(List <OrderDetail>)); return(orderManager.AddOrder(res, data.ID, data.IDShip, user, data.SDT, data.Latitude, data.Longtitude)); }
public Task Handle(PlaceOrder message, IMessageHandlerContext context) { if (orderManager.OrderExists(message.Id)) { orderManager.ModifyOrder(message.Id, message.Items); } else { orderManager.AddOrder(message.Id, message.Items); } return(Task.CompletedTask); }
public void AddOrder_Should_Add_Order_To_The_List() { var itemFixture = new Item { ItemNumber = "orderItem", AvailableQuantity = 2 }; _orderManager.AddItem(itemFixture); var orderFixture = new Order { ItemNumber = "orderItem", QuantityOrdered = 3 }; _orderManager.AddOrder(orderFixture); Assert.False(_order.Orders.Any(x => x.ItemNumber == "orderItem")); orderFixture = new Order { ItemNumber = "orderItem", QuantityOrdered = 1 }; _orderManager.AddOrder(orderFixture); Assert.True(_order.Orders.Any(x => x.ItemNumber == "orderItem")); }
public async Task <HttpResponseMessage> AddOrder(Entities.Entities.Order order) { Response <Entities.Entities.Order> _response = new Response <Entities.Entities.Order>(); try { _response.RequestState = true; _response.ErrorState = !await _orderManager.AddOrder(order); } catch (Exception ex) { _response.ErrorState = true; _response.ErrorList.Add(ex.Adapt <ApiException>()); } return(_response); }
public void AddOrder(Order order) { _logger.LogInformation("Call Add order method"); _orderManager.AddOrder(order); }
public async Task <IActionResult> PostOrder(OrderDto orderDto) { var order = await _orderManager.AddOrder(orderDto); return(Ok(order)); }
public async Task <IActionResult> PostOrders(OrderForListDto orderForListDto) { var order = await _orderManager.AddOrder(orderForListDto).ConfigureAwait(false); return(Ok(order)); }