Exemple #1
0
        // GET: Client/Detail
        public ActionResult Index(int id)
        {
            DetailDao dao = new DetailDao();
            sanpham   sp  = dao.getDetail(id);

            return(View(sp));
        }
        public ActionResult Create(string nameCustomer, string emailCustomer, string phoneCustomer, string addressCustomer)
        {
            if (Session["CartSession"] != null)
            {
                Order order = new Order();
                order.CustomerName    = nameCustomer;
                order.CustomerEmail   = emailCustomer;
                order.CustomerMobile  = Int64.Parse(phoneCustomer);
                order.CustomerAddress = addressCustomer;
                order.CreatedDate     = DateTime.Now;

                var  orderDao = new OrderDao();
                long orderID  = orderDao.InsertOrder(order);

                var             detailDao = new DetailDao();
                List <CartItem> cart      = (List <CartItem>)Session["CartSession"];
                foreach (var item in cart)
                {
                    detailDao.InsertOrderDetail(item.Product.ID, (float)item.Product.Price, item.Quantity, orderID);
                }
                Session.Remove("CartSession");
                Thread.Sleep(1000);
                return(Json(new { added = true }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new { added = false }, JsonRequestBehavior.AllowGet));
        }
        // GET: Client/Detail
        public ActionResult Index(int id)
        {
            DetailDao dao = new DetailDao();
            sanpham   sp  = dao.getDetail(id);

            ViewData["maloaisp"] = dao.getMaloaisanpham(id);
            return(View(sp));
        }
Exemple #4
0
        // GET: Admin/Detail
        public ActionResult Index(string searchString, int page = 1, int pageSize = 10)
        {
            var dao   = new DetailDao();
            var model = dao.ListAllPaging(searchString, page, pageSize);

            ViewBag.SearchString = searchString;
            return(View(model));
        }
Exemple #5
0
        public ActionResult GetOrderDetail(string id)
        {
            var detailDao      = new DetailDao();
            var list           = detailDao.GetListDetail(Int64.Parse(id));
            var jsonSerialiser = new JavaScriptSerializer();
            var json           = jsonSerialiser.Serialize(list);

            return(Json(new { search = true, data = json }, JsonRequestBehavior.AllowGet));
        }
Exemple #6
0
        public JsonResult ChangeStatus(long id)
        {
            var result = new DetailDao().ChangeStatus(id);

            return(Json(new
            {
                status = result
            }));
        }
Exemple #7
0
        public ActionResult Create(Detail model)
        {
            if (ModelState.IsValid)
            {
                var dao = new DetailDao();

                long id = dao.Insert(model);
                if (id > 0)
                {
                    return(RedirectToAction("Index", "Detail"));
                }
                else
                {
                    ModelState.AddModelError("", "Them detail thanh cong");
                }
            }
            return(View("Index"));
        }
Exemple #8
0
        public ActionResult Edit(Detail model)
        {
            if (ModelState.IsValid)
            {
                var dao = new DetailDao();

                if (!string.IsNullOrEmpty(model.Name))
                {
                    var result = dao.Update(model);
                    if (result)
                    {
                        return(RedirectToAction("Index", "Detail"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Cap nhap thanh cong");
                    }
                }
            }
            return(View());
        }
Exemple #9
0
 public DetailService()
 {
     detailDao = new DetailDao();
 }
Exemple #10
0
        public PartialViewResult CategoryDetail()
        {
            var model = new DetailDao().ListAll();

            return(PartialView(model));
        }
Exemple #11
0
        public ActionResult Edit(int id)
        {
            var user = new DetailDao().ViewDetail(id);

            return(View(user));
        }