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")); }
public PartialViewResult _LoadDanhSachTheoLoai(int?TheloaiId, int?SanPhamId) { TheLoaiService service = new TheLoaiService(); ViewBag._LoadDanhSachTheoLoai = new SelectList(service.DSTheLoai1(SanPhamId), "TheLoadId", "TenTheLoai", TheloaiId); return(PartialView()); }
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)); }
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)); }
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)); }