Exemplo n.º 1
0
        public ActionResult Them()
        {
            var dm = new DanhMucDAO();

            ViewBag.Categories = dm.GetAll();
            return(View("Them"));
        }
Exemplo n.º 2
0
        public ActionResult Delete(int id)
        {
            DanhMucDAO danhMucDAO = new DanhMucDAO();

            danhMucDAO.Delete(id);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        // GET: Admin/DanhMuc
        public ActionResult IndexDanhMuc()
        {
            var iplDanhMuc = new DanhMucDAO();
            var model      = iplDanhMuc.ListDanhMuc();

            return(View(model));
        }
Exemplo n.º 4
0
        // GET: ChiTietSanPham/Details/5
        public ActionResult Details(int id)
        {
            DanhMucDAO dm = new DanhMucDAO();

            ViewBag.danhMuc = dm.GetAll().ToList();
            return(View(db.Giays.Where(item => item.shoeId == id).SingleOrDefault()));
        }
Exemplo n.º 5
0
        // GET: Cart
        public ActionResult Index()
        {
            DanhMucDAO dm = new DanhMucDAO();

            ViewBag.danhMuc = dm.GetAll().ToList();
            return(View());
        }
Exemplo n.º 6
0
        public ActionResult Edit(int id)
        {
            KhachHangDAO khDAO = new KhachHangDAO();
            DanhMucDAO   dm    = new DanhMucDAO();

            ViewBag.danhMuc = dm.GetAll().ToList();
            return(View(khDAO.getUserById(id)));
        }
Exemplo n.º 7
0
        public DanhMucDTO LayTenDanhMuc(int maDM)
        {
            DanhMucDAO dmDAO = new DanhMucDAO();
            DanhMucDTO dmDTO = null;

            dmDTO = dmDAO.LayTenDanhMuc(maDM);
            return(dmDTO);
        }
Exemplo n.º 8
0
        public ActionResult Sua(int id)
        {
            SanPham entity = SanPhamDAO.getShoeById(id);
            var     dm     = new DanhMucDAO();

            ViewBag.Categories = dm.GetAll();
            return(View(entity));
        }
Exemplo n.º 9
0
        public DanhMucDTO LayMaDanhMuc(string tenDM)
        {
            DanhMucDAO dmDAO = new DanhMucDAO();
            DanhMucDTO dmDTO = null;

            dmDTO = dmDAO.LayMaDanhMuc(tenDM);
            return(dmDTO);
        }
        // GET: Admin/DanhMucBaiViet
        public ActionResult Index(string searchString, int page = 1, int pageSize = 5)
        {
            var dao   = new DanhMucDAO();
            var model = dao.ListAllPaging(searchString, page, pageSize);

            ViewBag.SearchString = searchString;

            return(View(model));
        }
Exemplo n.º 11
0
        public ActionResult CreateDanhMuc([Bind(Include = "MaDM,TenDM,MetaTitle")] DanhMuc dm)
        {
            if (ModelState.IsValid)
            {
                DanhMucDAO danhMucDAO = new DanhMucDAO();

                danhMucDAO.Create(dm);
                return(Redirect("Index"));
            }
            return(View("Create"));
        }
        // GET: HangKhuyenMai
        public ActionResult Index(int?page)
        {
            int        pageSize   = 10;
            int        pageNumber = page ?? 1;
            DanhMucDAO dm         = new DanhMucDAO();

            ViewBag.danhMuc = dm.GetAll().ToList();
            var list = db.SanPhams.Where(item => item.comparePrice > item.price).ToList().ToPagedList(pageNumber, pageSize);

            return(PartialView(list));
        }
Exemplo n.º 13
0
 public ActionResult EditDanhMuc(DanhMuc dm)
 {
     if (ModelState.IsValid)
     {
         DanhMucDAO danhMucDAO = new DanhMucDAO();
         danhMucDAO.Edit(dm);
         return(Redirect("Index"));
     }
     else
     {
         return(View("Edit", dm));
     }
 }
Exemplo n.º 14
0
        public ActionResult MyAccount()
        {
            DanhMucDAO dm = new DanhMucDAO();

            ViewBag.danhMuc = dm.GetAll().ToList();
            var userId = System.Web.HttpContext.Current.Session["USER_ID"];

            if (userId != null)
            {
                var kh = db.KhachHangs.ToList().Where(item => item.userId == Convert.ToInt32(userId)).SingleOrDefault();
                return(View(kh));
            }
            return(RedirectToAction("Index"));
        }
 protected void data_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Sua")
     {
         id = (string)e.CommandArgument;
         Response.Redirect("suachuyenmuc.aspx?id=" + id);
     }
     else
     {
         id = (string)e.CommandArgument;
         DanhMucDAO DAO = new DanhMucDAO();
         DAO.XoaDanhMuc(id);
         LoadDuLieu();
     }
 }
Exemplo n.º 16
0
        public ActionResult Index()
        {
            ViewBag.Slides = new SlideDAO().ListAll();
            var productDAO        = new ProductDAO();
            var DanhMucDAO        = new DanhMucDAO();
            var DanhMucSanPhamDAO = new CategoryProductDAO();

            ViewBag.NewProducts         = productDAO.ListNewProduct(4);
            ViewBag.NewProducts1        = productDAO.ListNewProduct1(4);
            ViewBag.ListFeatureProducts = productDAO.ListFeatureProduct(4);
            ViewBag.SanPhamBanChay      = productDAO.SanPhamBanChay(4);
            ViewBag.DanhMuc             = DanhMucDAO.ListAll();
            ViewBag.DanhMucSanPham      = DanhMucSanPhamDAO.ListCategoryProduct();
            ViewBag.SanPham             = productDAO.ListAll();
            return(View());
        }
        public ActionResult Edit(DanhMucBaiViet user)
        {
            var dao    = new DanhMucDAO();
            var result = dao.Update(user);

            if (result)
            {
                SetAlert("Sửa danh mục thành công", "success");
                return(RedirectToAction("Index", "DanhMucBaiViet"));
            }
            else
            {
                ModelState.AddModelError("", "Cập nhật danh mục không thành công");
            }

            return(View("Index"));
        }
Exemplo n.º 18
0
        public ActionResult KiemTraDonHang()
        {
            DanhMucDAO dm = new DanhMucDAO();

            ViewBag.danhMuc = dm.GetAll().ToList();
            var userId = Convert.ToInt32(System.Web.HttpContext.Current.Session["USER_ID"]);
            var dh     = db.DonHangs.Where(donhang => donhang.userId == userId).Select(item => new DonHangViewModel()
            {
                address    = item.address,
                createdAt  = item.createdAt,
                orderId    = item.orderId,
                status     = item.status,
                totalMoney = db.ChiTietDonHangs.Where(i => i.orderId == item.orderId).Sum(i => i.price * i.quantity)
            }).ToList();

            return(View(dh));
        }
Exemplo n.º 19
0
        public ActionResult Shop(int?page, string currentFilter, string size = "all", string price = "0", string filterType = "all", string sortOrder = "option", string sortActive = "Tùy chọn")
        {
            DanhMucDAO dm = new DanhMucDAO();
            SanPhamDAO x  = new SanPhamDAO();

            ViewBag.danhMuc    = dm.GetAll().ToList();
            ViewBag.price      = price.ToString();
            ViewBag.filterType = filterType;
            ViewBag.action     = "Shop";
            ViewBag.title      = "Shop";
            ViewBag.size       = size;
            ViewBag.sortOrder  = sortOrder;
            ViewBag.sortActive = sortActive;
            int pageSize   = 4;
            int pageNumber = page ?? 1;

            return(View(x.GetAll().ToPagedList(pageNumber, pageSize)));
        }
Exemplo n.º 20
0
        public ActionResult GiayNam(int?page, string currentFilter, string size = "all", string price = "0", string filterType = "all", string sortOrder = "option", string sortActive = "Tùy chọn")
        {
            DanhMucDAO dm = new DanhMucDAO();
            GiayDAO    x  = new GiayDAO();

            ViewBag.danhMuc    = dm.GetAll().ToList();
            ViewBag.price      = price.ToString();
            ViewBag.filterType = filterType;
            ViewBag.action     = "GiayNam";
            ViewBag.title      = "Giày nam";
            ViewBag.size       = size;
            ViewBag.sortOrder  = sortOrder;
            ViewBag.sortActive = sortActive;
            int pageSize   = 4;
            int pageNumber = page ?? 1;

            return(View(x.getProductsMale(size, price, filterType, sortOrder).ToPagedList(pageNumber, pageSize)));
        }
        public ActionResult Create(DanhMucBaiViet model)
        {
            if (ModelState.IsValid)
            {
                var currentCulture = Session[CommonConstants.CurrentCulture];

                var id = new DanhMucDAO().Insert(model);
                if (id > 0)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Thêm danh mục không thành công");
                }
            }
            return(View(model));
        }
Exemplo n.º 22
0
 protected void btnThem_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         string  TenDanhMuc = txtTenDanhMuc.Text;
         DanhMuc danhMuc    = new DanhMuc
         {
             Tendanhmuc = TenDanhMuc
         };
         DanhMucDAO DAO = new DanhMucDAO();
         if (DAO.ThemDanhMuc(danhMuc))
         {
             lblThongBao.Text = "Thêm danh mục thành công.";
         }
         else
         {
             lblThongBao.Text = "Có lỗi trong quá trình thêm. Liên hệ DEV";
         }
     }
 }
Exemplo n.º 23
0
 protected void btnSua_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         string  TenDanhMuc = txtTenDanhMuc.Text;
         DanhMuc danhMuc    = new DanhMuc
         {
             Iddanhmuc  = int.Parse(Request.QueryString["id"]),
             Tendanhmuc = TenDanhMuc
         };
         DanhMucDAO DAO = new DanhMucDAO();
         if (DAO.SuaDanhMuc(danhMuc))
         {
             lblThongBao.Text = "Cập nhật thành công.";
         }
         else
         {
             lblThongBao.Text = "Có lỗi trong quá trình sửa. Liên hệ DEV";
         }
     }
 }
Exemplo n.º 24
0
        // GET: Account
        public ActionResult Index(bool?isLogout)
        {
            DanhMucDAO dm = new DanhMucDAO();

            ViewBag.danhMuc = dm.GetAll().ToList();
            if (isLogout == true)
            {
                System.Web.HttpContext.Current.Session.Clear();
            }
            else
            {
                var userId = System.Web.HttpContext.Current.Session["USER_ID"];
                if (userId != null)
                {
                    var kh = db.KhachHangs.ToList().Where(item => item.userId == Convert.ToInt32(userId)).SingleOrDefault();
                    return(RedirectToAction("MyAccount"));
                }
            }

            return(View());
        }
Exemplo n.º 25
0
        public void setViewBagForSanPham()
        {
            LoaiDAO       l  = new LoaiDAO();
            ThuongHieuDAO th = new ThuongHieuDAO();
            MauDAO        m  = new MauDAO();
            KichCoDAO     kc = new KichCoDAO();
            DanhMucDAO    dm = new DanhMucDAO();

            ViewBag.listImage = ImageHelper.loadListImage();           //lay danh sach hinh anh

            ViewBag.MaLoai = l.getDanhSach();                          //lay tat cac cac loai ---giai quyet

            ViewBag.MaThuongHieu = th.getTatCaThuongHieu();            //lay thuong hieu

            ViewBag.DanhSachSanPham = spDAO.layDanhSachTatCaSanPham(); //lay tat ca sp

            ViewBag.Mau = m.getDanhSach();                             //lat tat ca mau

            ViewBag.KichCo = kc.getDanhSach();                         //lat tat ca mau

            ViewBag.DanhMuc = dm.getDanhMuc();                         // lấy tất cả danh mục
        }
Exemplo n.º 26
0
        public ActionResult TheLoai(int?page, int?id, string typeMaleorFemale, string categoryName, string price = "0", string filterType = "all", string size = "all", string sortOrder = "option", string sortActive = "Tùy chọn")
        {
            SanPhamDAO g  = new SanPhamDAO();
            DanhMucDAO dm = new DanhMucDAO();

            ViewBag.danhMuc = dm.GetAll().ToList();
            ViewBag.filterTypeMaleorFemale = typeMaleorFemale;
            ViewBag.filterType             = filterType;
            ViewBag.action     = "TheLoai";
            ViewBag.price      = price.ToString();
            ViewBag.title      = categoryName;
            ViewBag.size       = size;
            ViewBag.sortActive = sortActive;
            ViewBag.sortOrder  = sortOrder;
            if (id == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            int pageSize   = 3;
            int pageNumber = page ?? 1;

            return(View("TheLoai", g.GetProductsBaseCategoryId(id ?? 0, typeMaleorFemale, price, filterType, size, sortOrder).ToPagedList(pageNumber, pageSize)));
        }
Exemplo n.º 27
0
        public ActionResult Register(KhachHang kh)
        {
            DanhMucDAO dm = new DanhMucDAO();

            ViewBag.danhMuc = dm.GetAll().ToList();
            if (ModelState.IsValid)
            {
                var khachHangDDAO = new KhachHangDAO();
                var pw            = Encryptor.MD5Hash(kh.password);
                var cfpw          = Encryptor.MD5Hash(kh.confirmPassword);
                kh.password        = pw;
                kh.confirmPassword = cfpw;
                var res = khachHangDDAO.them(kh);
                if (res)
                {
                    ViewBag.Message = "Thêm khách hàng thành công";
                    return(RedirectToAction("Index"));
                }
                ModelState.AddModelError("", "Email đã tồn tại. Vui lòng chọn email khác!");
                return(View());
            }
            return(View());
        }
        public void SetViewBag()
        {
            DanhMucDAO dao = new DanhMucDAO();

            ViewBag.CategoryID = new SelectList(dao.ListAll(), "DanhMucID", "TenDanhMuc");
        }
Exemplo n.º 29
0
        public void LoadDanhMuc(long?selectedId = null)
        {
            var dao = new DanhMucDAO();

            ViewBag.DanhMucID = new SelectList(dao.ListAll(), "ID", "TenDanhMuc", selectedId);
        }
Exemplo n.º 30
0
        public ActionResult DropBaiViet()
        {
            var model = new DanhMucDAO().ListAll();

            return(PartialView(model));
        }