public ActionResult Index() { shAboutService _about = new shAboutService(); shAboutu about = _about.DanhSachAbout().OrderBy(x => x.AboutId).FirstOrDefault(); IEnumerable <shAboutu> dsChildAbout = _about.DanhSachAbout_ByParentId(about.AboutGuid).OrderBy(x => x.AboutId); ViewBag.dsChildAbout = dsChildAbout; return(View(about)); }
public ActionResult Details(int?id) { shAboutService _about = new shAboutService(); shAboutu about = new shAboutu(); if (id.HasValue) { about = _about.FindList().Where(x => x.AboutId == id).FirstOrDefault(); } IEnumerable <shAboutu> dsChild = _about.DanhSachAbout_ByParentId(about.AboutGuid); ViewBag.dsChild = dsChild; return(View(about)); }
public ActionResult Create(string id) { ViewBag.BannerGuid = id; shAboutService _about = new shAboutService(); shAboutu about = new shAboutu(); if (!string.IsNullOrWhiteSpace(id)) { about = _about.FindByKey(id); } IEnumerable <shAboutu> dsAbout = _about.DanhSachAbout(); ViewBag.Parent = new SelectList(dsAbout, "AboutGuid", "AboutTitle", about.ParentId); return(View(about)); }
public ActionResult Create(string AboutGuid, string AboutTitle, string AboutName, string AboutContent, int?Year, string Parent, string Sign, string ImageUrl, int?SortOrder, bool?Status, string Url) { using (var context = new ShopOnlineDb()) { using (var dbContextTransaction = context.Database.BeginTransaction()) { try { shAboutService _about = new shAboutService(); shAboutu about = new shAboutu(); about = _about.Insert_About( AboutGuid, null, AboutTitle, AboutName, AboutContent, Year, Sign, ImageUrl, Parent, SortOrder, Status, DateTime.Now); dbContextTransaction.Commit(); } catch (Exception ex) { dbContextTransaction.Rollback(); } } } return(RedirectToAction("Index")); }