public ActionResult Create(GroupMath collection) { try { GroupMathDao bdDao = new GroupMathDao(); UserLogin us = (UserLogin)Session[SystemConsts.USER_SESSION]; collection.CreateBy = us.UserName; collection.CreateDate = Hepper.GetDateServer(); collection.ModifiedBy = us.UserName; collection.ModifiedDate = Hepper.GetDateServer(); collection.LanguageID = "vi"; //collection.CreateBy = us.UserName; //collection.ModifiedBy = us.UserName; if (bdDao.Insert(collection)) { SetAlert(@Resources.ResourceAdmin.AdminCreateRecordSuccess, "success"); return(RedirectToAction("Index")); } else { SetAlert(@Resources.ResourceAdmin.AdminCreateRecordFailed, "danger"); } return(RedirectToAction("Index")); } catch { SetAlert(@Resources.ResourceAdmin.AdminCreateRecordFailed, "danger"); return(View()); } }
public ActionResult Edit(GroupMath collection) { GroupMathDao bdDao = new GroupMathDao(); try { UserLogin us = (UserLogin)Session[SystemConsts.USER_SESSION]; collection.ModifiedBy = us.UserName; collection.ModifiedDate = Hepper.GetDateServer(); if (bdDao.Update(collection)) { SetAlert(@Resources.ResourceAdmin.AdminEditRecordSucess, "success"); return(RedirectToAction("Index")); } else { SetAlert(@Resources.ResourceAdmin.AdminEditRecordFailed, "danger"); } return(RedirectToAction("Index")); } catch { SetAlert(@Resources.ResourceAdmin.AdminEditRecordFailed, "danger"); return(View()); } }
public bool Update(GroupMath mode) { try { var bd = db.GroupMaths.Find(mode.GroupMathsID); if (string.IsNullOrEmpty(mode.MetaTite)) { bd.MetaTite = HepperString.ToUnsignString(mode.Name); } else { bd.MetaTite = mode.MetaTite; } if (string.IsNullOrEmpty(mode.SeoTite)) { bd.SeoTite = mode.Name; } else { bd.SeoTite = mode.SeoTite; } // bd.GroupMathID = mode.GroupMathID; //bd.CreateBy = mode.CreateBy; //bd.CreateDate = mode.CreateDate; bd.Description = mode.Description; bd.DisplayOrder = mode.DisplayOrder; // bd.LanguageID = mode.LanguageID; bd.MetaDescription = mode.MetaDescription; bd.MetakeyWords = mode.MetakeyWords; bd.ModifiedBy = mode.ModifiedBy; bd.ModifiedDate = mode.ModifiedDate; bd.ShowOnHome = mode.ShowOnHome; bd.Status = mode.Status; bd.Name = mode.Name; db.SaveChanges(); return(true); } catch { return(false); } }
// GET: Admin/GroupMath/Details/5 public ActionResult Details(long id) { GroupMathDao dbDAO = new GroupMathDao(); GroupMath cat = null; try { cat = dbDAO.FindByID(id); } catch { ModelState.AddModelError("", Resources.ResourceAdmin.ErrorGetRecordMessage); } return(View(cat)); }
public ActionResult Edit(long id) { GroupMathDao dbDAO = new GroupMathDao(); GroupMath cat = null; try { cat = dbDAO.FindByID(id); // ViewBag.GroupID = new SelectList(dbContext..ToList(), "ID", "Name"); } catch { ModelState.AddModelError("", Resources.ResourceAdmin.ErrorGetRecordMessage); } return(View(cat)); }
public bool Insert(GroupMath mode) { try { if (string.IsNullOrEmpty(mode.MetaTite)) { mode.MetaTite = HepperString.ToUnsignString(mode.Name); } if (string.IsNullOrEmpty(mode.SeoTite)) { mode.SeoTite = mode.Name; } db.GroupMaths.Add(mode); db.SaveChanges(); return(true); } catch { return(false); } }