public ActionResult paidOrders(string sortOrder, string searchString, Orderd order) { ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : ""; ViewBag.DateSortParm = sortOrder == "Date" ? "date_desc" : "Date"; var paid = from s in db.Orderss.Where(x => x.Paid == true && x.scheduled == false) select s; if (!String.IsNullOrEmpty(searchString)) { paid = paid.Where(s => s.FullName.Contains(searchString) || s.Phone.Contains(searchString)); } switch (sortOrder) { case "name_desc": paid = paid.OrderByDescending(s => s.FullName); break; case "Date": paid = paid.OrderBy(s => s.OrderDate); break; case "date_desc": paid = paid.OrderByDescending(s => s.OrderDate); break; default: paid = paid.OrderBy(s => s.FullName); break; } return(View(paid.ToList())); //var paid = db.Orderss.ToList().Where(x => x.Paid == "Y" && x.scheduled == false); //return View(paid); }
// GET: Orders public ActionResult Index(string sortOrder, string searchString, Orderd order) { ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : ""; ViewBag.DateSortParm = sortOrder == "Date" ? "date_desc" : "Date"; var asd = from s in db.Orderss/*.Where(x=>x.Username==User.Identity.Name)*/ select s; if (!String.IsNullOrEmpty(searchString)) { asd = asd.Where(s => s.FullName.Contains(searchString) || s.Phone.Contains(searchString)); } switch (sortOrder) { case "name_desc": asd = asd.OrderByDescending(s => s.FullName); break; case "Date": asd = asd.OrderBy(s => s.OrderDate); break; case "date_desc": asd = asd.OrderByDescending(s => s.OrderDate); break; default: asd = asd.OrderBy(s => s.FullName); break; } return(View(asd.ToList())); }
public ActionResult Confirmed(int id) { Orderd order = db.Orderss.Find(id); var invoice = db.customerInvoice.ToList().Find(x => x.OrderId == order.OrderId); order.Status = "Cancelled"; invoice.Status = "Cancelled"; db.Entry(order).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index3")); }
public ActionResult OrderData(int?id) { Orderd order = db.Orderss.Find(id); Session["id"] = order.OrderId.ToString(); Session["user"] = order.Username; Session["name"] = order.FullName; Session["add"] = order.Address; Session["phone"] = order.Phone; return(View(order)); }
public ActionResult DeleteConfirmed(int id) { Orderd order = db.Orderss.Find(id); var delivery = db.delivery.ToList().Find(x => x.OrderId == id); db.Orderss.Remove(order); if (delivery != null) { db.delivery.Remove(delivery); } db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: Orders/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Orderd order = db.Orderss.Find(id); if (order == null) { return(HttpNotFound()); } return(View(order)); }
public ActionResult AddressAndPayment(FormCollection values) { var order = new Orderd(); decimal perc = 0.14M; var id = User.Identity.GetUserId(); var cust = db.Users.ToList().Find(x => x.Id == id); TryUpdateModel(order); order.Username = User.Identity.Name; order.OrderDate = DateTime.Now; order.FullName = cust.fullname; order.Address = cust.address; order.Phone = cust.contactnumber; order.Email = cust.Email; order.BusName = cust.businessname; order.BusNum = cust.businessnumber; ShoppingCart s = new ShoppingCart(); var cart1 = ShoppingCart.GetCart(this.HttpContext); order.ExclTotal = cart1.GetTotal(); order.InclTotal = cart1.GetTotal() + (cart1.GetTotal() * (float)perc); order.Paid = false; db.Orderss.Add(order); db.SaveChanges(); //Process the order var cart = ShoppingCart.GetCart(this.HttpContext); cart.CreateOrder(order); Session["id"] = order.OrderId.ToString(); return(RedirectToAction("Complete", "Checkout")); //return RedirectToAction("Index3", "Orders"); }