// GET: Admin/OrderBy public ActionResult Index(string searchString, int page = 1, int pageSize = 10) { var DAO = new OrderByDAO(); var model = DAO.ListAllOrderBy(searchString, page, pageSize); ViewBag.SearchString = searchString; return(View(model)); }
public JsonResult ChangeStatus(long id) { var result = new OrderByDAO().ChangeStatus(id); return(Json(new { status = result })); }
public ActionResult Payment(string shipName, string mobile, string address, string email) { var order = new OrderBy(); order.CreatedDate = DateTime.Now; order.ShipName = shipName; order.ShipMobile = mobile; order.ShipEmail = email; order.ShipAddress = address; try { decimal total = 0; var id = new OrderByDAO().Insert(order); var cart = (List <CartChild>)Session[CommonConstants.CART_SESSION]; var detailDAO = new OrderDetailDAO(); foreach (var item in cart) { var orderdetail = new OrderDetail(); orderdetail.ProductID = item.Product.ID; orderdetail.OrderID = id; orderdetail.Price = item.Product.Price; orderdetail.Quantity = item.Quantity; orderdetail.Status = true; detailDAO.Insert(orderdetail); total += (item.Product.Price.GetValueOrDefault(0) * item.Quantity); } string content = System.IO.File.ReadAllText(Server.MapPath("/Assets/Client/template/neworder.html")); content = content.Replace("{{CustomerName}}", shipName); content = content.Replace("{{Phone}}", mobile); content = content.Replace("{{Email}}", email); content = content.Replace("{{Address}}", address); content = content.Replace("{{Total}}", string.Format("{0:C}", (total)).Replace(",00", "")); new MailHelper().SendMail("Đơn hàng từ AppleStore", content); } catch (Exception) { throw; } return(RedirectToAction("Success", "Cart")); }
public ActionResult Edit(OrderBy order) { if (ModelState.IsValid) { var DAO = new OrderByDAO(); var result = DAO.Update(order); if (result) { SetAlert("Cập nhật thành công", "success"); return(RedirectToAction("Index", "OrderBy")); } else { SetAlert("Cập nhật thất bại", "error"); ModelState.AddModelError("", "Cập nhật thất bại"); } } return(View("Index")); }
public ActionResult Create(OrderBy order) { if (ModelState.IsValid) { var DAO = new OrderByDAO(); long id = DAO.Insert(order); if (id > 0) { SetAlert("Thêm thành công", "success"); return(RedirectToAction("Index", "OrderBy")); } else { SetAlert("Thêm thất bại", "error"); ModelState.AddModelError("", "Thêm thất bại"); } } return(View("Index")); }
public ActionResult Edit(int id) { var order = new OrderByDAO().ViewDetail(id); return(View(order)); }