//[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)); }
//[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)); }