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

            return(View(sp));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        // 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 6
0
        public JsonResult ChangeStatus(long id)
        {
            var result = new DetailDao().ChangeStatus(id);

            return(Json(new
            {
                status = result
            }));
        }
Exemplo n.º 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"));
        }
Exemplo n.º 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());
        }
Exemplo n.º 9
0
 public DetailService()
 {
     detailDao = new DetailDao();
 }
Exemplo n.º 10
0
        public PartialViewResult CategoryDetail()
        {
            var model = new DetailDao().ListAll();

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

            return(View(user));
        }