Beispiel #1
0
        public ActionResult _Form(int?Id
                                  , string TenTheLoai
                                  , string TieuDe
                                  , string MoTa
                                  )
        {
            var            session = (UserLogin)Session[CommonConstants.USER_SESSION];
            TheLoaiService _tl     = new TheLoaiService();

            Models.TheLoai tl = _tl.FindByKeys(Id);
            tl.TenTheLoai = TenTheLoai;
            tl.TieuDe     = TieuDe;
            tl.MoTa       = MoTa;
            if (Id.HasValue)
            {
                tl.NguoiSua = session.Name;
                tl.NgaySua  = DateTime.Now;
                _tl.Update(tl);
                setAlert("Thông tin sản phẩm đã được cập nhập", "success");
            }
            else
            {
                tl.NgayTao = DateTime.Now;
                _tl.Insert(tl);
                setAlert("Thêm sản phẩm thành công", "success");
            }
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
        public PartialViewResult _LoadDanhSachTheoLoai(int?TheloaiId, int?SanPhamId)
        {
            TheLoaiService service = new TheLoaiService();

            ViewBag._LoadDanhSachTheoLoai = new SelectList(service.DSTheLoai1(SanPhamId), "TheLoadId", "TenTheLoai", TheloaiId);
            return(PartialView());
        }
Beispiel #3
0
        public JsonResult _LoadDanhSachTheLoai(int?TheLoaiId)
        {
            TheLoaiService _service = new TheLoaiService();
            var            data     = _service.DSTheLoai();

            return(Json(
                       data.Select(x => new { text = x.TenTheLoai, id = x.TheLoadId, selected = TheLoaiId == x.TheLoadId }).ToList()
                       , JsonRequestBehavior.AllowGet));
        }
Beispiel #4
0
        public PartialViewResult _Form(int?Id)
        {
            var tl = new Models.TheLoai();

            if (Id.HasValue && Id != null)
            {
                var theloai = new TheLoaiService();
                tl = theloai.FindByKeys(Id);
            }
            return(PartialView(tl));
        }
Beispiel #5
0
        public PartialViewResult LoadDsTheLoai(string TenTheLoai, int?PageCurrent)
        {
            TheLoaiService service              = new TheLoaiService();
            int            pageNumber           = PageCurrent ?? 1;
            IPagedList <Models.TheLoai> theloai = service.GetDsTheLoai(TenTheLoai
                                                                       , pageNumber
                                                                       , 10
                                                                       );

            ViewBag.TenTheLoai  = TenTheLoai;
            ViewBag.PageCurrent = PageCurrent;
            return(PartialView("_DanhSachTheLoai", theloai));
        }