Beispiel #1
0
        public ActionResult GetMyOrders()
        {
            var myOrders        = new SalesDataService().GetSalesBySalesPerson(User.Identity.GetUserId());
            var myOrderedOrders = myOrders.OrderByDescending(x => x.SalesStartDate);
            var orderViewModel  = myOrderedOrders.Select(x => new OrderViewModel(x));

            return(new JsonResult()
            {
                Data = orderViewModel,
                ContentType = "application/json",
                JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                MaxJsonLength = Int32.MaxValue
            });
        }
Beispiel #2
0
        public ActionResult GetAllActiveOrders()
        {
            var allActiveOrders     = new SalesDataService().GetAllSales().Where(x => x.SalesState != SalesState.InvoiceDoneAndPacked);
            var orderedActiveOrders = allActiveOrders.OrderByDescending(x => x.SalesStartDate);
            var orderViewModel      = orderedActiveOrders.Select(x => new OrderViewModel(x));

            return(new JsonResult()
            {
                Data = orderViewModel,
                ContentType = "application/json",
                JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                MaxJsonLength = Int32.MaxValue
            });
        }