コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: UnitTest1.cs プロジェクト: rkulavil/SnowJoe
        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"));
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 public void AddOrder(Order order)
 {
     _logger.LogInformation("Call Add order method");
     _orderManager.AddOrder(order);
 }
コード例 #6
0
        public async Task <IActionResult> PostOrder(OrderDto orderDto)
        {
            var order = await _orderManager.AddOrder(orderDto);

            return(Ok(order));
        }
コード例 #7
0
        public async Task <IActionResult> PostOrders(OrderForListDto orderForListDto)
        {
            var order = await _orderManager.AddOrder(orderForListDto).ConfigureAwait(false);

            return(Ok(order));
        }