// GET: OrderItem/Create
        public ActionResult Create(OrderBatchModel order)
        {
            var viewModel = new OrderItemModel
            {
                Products = Repo.GetProducts(),
                BatchId  = order.Id,
            };

            return(View(viewModel));
        }
        public OrderBatchModel Get(
            [FromUri] OrderBatchSearchCriteria searchCriteria,
            [FromUri] PaginationOptions options)
        {
            options = GetPaginationOptions(options);

            var orderBatch = _orderBatchService.GetByLocation(searchCriteria.LocationId, searchCriteria.OrderType, _workContext.User);

            if (orderBatch == null)
            {
                return(new OrderBatchModel());
            }

            OrderBatchModel model = orderBatch.ToModel <OrderBatchModel>();

            var orders = _orderBatchService.SearchOrders(orderBatch.Id, searchCriteria.DepartmentId, searchCriteria.UserId, searchCriteria.UserName, options);

            model.Orders               = orders.ToModelList <Order, OrderModel>();
            model.TotalOrders          = orders.TotalCount;
            model.TotalValueWithFilter = model.Orders.Sum(x => x.Value);

            return(model);
        }
Esempio n. 3
0
 public ActionResult Create(OrderBatchModel orderBatch)
 {
     try
     {
         // TODO: Add insert logic here
         if (ModelState.IsValid)
         {
             Repo.AddOrderBatch(new Lib.OrderBatch
             {
                 CustomerId = orderBatch.CustomerId,
                 StoreId    = orderBatch.StoreId,
                 Date       = DateTime.Now
             });
             Repo.Save();
             return(RedirectToAction(nameof(Index), new { customerId = orderBatch.CustomerId }));
         }
         return(View());
     }
     catch
     {
         return(View());
     }
 }