//[Authorize]
        public ActionResult Order()
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);
            OrdersViewModel    ovm = new OrdersViewModel();

            ovm.categories          = cpr.GetAllCategories();
            ovm.products            = cpr.GetProductsByCategory(1);
            ovm.productAvailability = cpr.GetProductAvailability(DateTime.Today.Date.AddMonths(-1), DateTime.Today.Date.AddDays(7), 1);
            return(View(ovm));
        }
        public ActionResult Inventory(DateTime min, DateTime max, int dayReq, int categoryId)
        {
            InventoryByCategoryModel ibcm = new InventoryByCategoryModel();
            CakesPosRepository       cpr  = new CakesPosRepository(_connectionString);

            ibcm.inventory   = cpr.GetInventory(min, max).Where(c => c.product.CategoryId == categoryId);
            ibcm.categories  = cpr.GetAllCategories();
            ViewBag.category = categoryId;
            ViewBag.minDate  = min;
            ViewBag.maxDate  = max;
            ViewBag.dayReq   = dayReq;
            return(View(ibcm));
        }
        //[HttpPost]
        //public ActionResult Order(int customerId, int orderId)
        //{
        //    CakesPosRepository cpr = new CakesPosRepository(_connectionString);
        //    OrdersViewModel ovm = new OrdersViewModel();
        //    ovm.categories = cpr.GetAllCategories();
        //    ovm.products = cpr.GetProductsByCategory(1);
        //    ovm.order = cpr.GetOrderById(orderId);
        //    ovm.orderDetails = cpr.GetOrderDetailsById(orderId);
        //    return View(ovm);
        //}

        //[HttpPost]
        public ActionResult EditOrder(int customerId, int orderId)
        {
            CakesPosRepository  cpr = new CakesPosRepository(_connectionString);
            EditOrdersViewModel ovm = new EditOrdersViewModel();

            ovm.categories = cpr.GetAllCategories();
            ovm.products   = cpr.GetProductsByCategory(1);
            //ovm.order = cpr.GetOrderById(orderId);
            //ovm.orderDetails = cpr.GetOrderDetailsById();
            //ovm.customer = cpr.GetCustomerById(customerId);
            //ovm.orderedProducts=cpr.
            ovm.productAvailability = cpr.GetProductAvailability(DateTime.Today.AddMonths(-1), DateTime.Today.AddDays(3), 1);
            ovm.orderDetails        = cpr.GetOrderDetails(customerId, orderId);
            return(View(ovm));
        }
        public ActionResult Inventory()
        {
            DateTime min = DateTime.Now.Date.AddMonths(-1);
            DateTime max = DateTime.Now.Date.AddDays(3);
            InventoryByCategoryModel ibcm = new InventoryByCategoryModel();
            CakesPosRepository       cpr  = new CakesPosRepository(_connectionString);

            ibcm.inventory   = cpr.GetInventory(min, max);
            ibcm.categories  = cpr.GetAllCategories();
            ViewBag.category = 1;
            ViewBag.minDate  = min;
            ViewBag.maxDate  = max;
            ViewBag.dayReq   = 4;
            return(View(ibcm));
        }
        //[HttpPost]
        //public ActionResult OrderHistoryWeek()
        //{
        //    CakesPosRepository cpr = new CakesPosRepository(_connectionString);
        //    IEnumerable<OrderHistoryViewModel> orders = cpr.GetOrders().Where(o => o.requiredDate >= DateTime.Today.AddDays(-7));
        //    return Json(orders, JsonRequestBehavior.AllowGet);
        //}

        //[HttpPost]
        //public ActionResult OrderHistoryLast30Days()
        //{
        //    CakesPosRepository cpr = new CakesPosRepository(_connectionString);
        //    IEnumerable<OrderHistoryViewModel> orders = cpr.GetOrders().Where(o => o.requiredDate >= DateTime.Today.AddDays(-30));
        //    return Json(orders, JsonRequestBehavior.AllowGet);
        //}

        public ActionResult Admin()
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);

            return(View(cpr.GetAllCategories()));
        }
        //[HttpGet]
        public ActionResult GetCatagories()
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);

            return(Json(cpr.GetAllCategories(), JsonRequestBehavior.AllowGet));
        }