public ActionResult SaveEdit(BannerDanhSach model) { BannerDanhSach dlcu = _bannerDanhSachRepository.GetById(model.id_); dlcu.id_ = model.id_; dlcu.TenBanner = model.TenBanner; dlcu.ViTri = model.ViTri; dlcu.HinhAnh = (model.HinhAnh).Replace("/files/", ""); dlcu.IdDanhMuc = 0; dlcu.BannerQCDanhSach = true; dlcu.BannerQCChiTiet = false; dlcu.LinkHttp1 = model.LinkHttp1; dlcu.Ok = model.Ok; _bannerDanhSachRepository.Update(dlcu); _unitOfWork.Commit(); return(RedirectToAction("Index")); }
public ActionResult AddNew(BannerTrangDanhSachModel model) { if (ModelState.IsValid) { BannerDanhSach menu = new BannerDanhSach() { HinhAnh = (model.HinhAnh).Replace("/files/", ""), TenBanner = model.TenBanner, ViTri = model.ViTri, IdDanhMuc = 0, BannerQCChiTiet = false, BannerQCDanhSach = true, LinkHttp1 = model.LinkHttp1, Ok = false }; _bannerDanhSachRepository.Add(menu); _unitOfWork.Commit(); } else { return(View("Create", model)); } return(RedirectToAction("Index")); }