Beispiel #1
0
        public ActionResult GetIndex(int id)
        {
            ViewBag.Customers = CustomerRepository.GetCustomerList();
            ViewBag.Products  = ProductRepository.GetProductList();

            var OrderViewDataModel = CustomerOrderRepository.GetOrder(id);

            List <OrderBox> BoxList = new List <OrderBox>();

            foreach (var item in OrderViewDataModel.CustomerOrder)
            {
                BoxList.Add(new OrderBox()
                {
                    Amount          = item.Amount,
                    Barcode         = item.Barcode,
                    Description     = item.Description,
                    GUID            = item.GUID,
                    Price           = Convert.ToDecimal(item.Price),
                    ProductId       = item.ProductId,
                    CustomerOrderId = item.CustomerOrderId,
                    ProductName     = item.ProductName
                });
            }
            Session["OrderBoxList"] = BoxList;

            return(View("Index", OrderViewDataModel));
        }
Beispiel #2
0
        public HttpResponseMessage GetOrder(int id)
        {
            HttpResponseMessage message = null;

            try
            {
                CustomerOrderRepository orderRepo = new CustomerOrderRepository();
                var order = orderRepo.GetOrder(id);

                message = Request.CreateResponse(HttpStatusCode.Accepted, order);
                order   = null;
            }
            catch (Exception ex)
            {
                message = Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message.ToString());
            }

            return(message);
        }