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()); } }
private void GroupMathDropDownList(object selectedParent = null) { GroupMathDao bdDao = new GroupMathDao(); var items = bdDao.ToList(); ViewBag.Parents = new SelectList(items, "GroupMathsID", "Name", selectedParent); }
public ActionResult Delete(long id) { try { // TODO: Add delete logic here GroupMathDao bdDao = new GroupMathDao(); MathStudentDao dbNewDao = new MathStudentDao(); if (dbNewDao.ToListByGroupID(id).Count > 0) { SetAlert("Đang sử dụng không được phép xóa", SystemConsts.ALERT_DANGER); return(RedirectToAction("Index")); } bdDao.Delete(id); // SetAlert("Xóa thành công", "success"); return(RedirectToAction("Index")); } catch { // SetAlert("Không xóa được", "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()); } }
// GET: Admin/GroupMath public ActionResult Index() { GroupMathDao bdDao = new GroupMathDao(); ViewBag.lstCate = bdDao.ToList(); //TempData["AlertMessage"] = null; return(View(ViewBag.lstCate)); }
// GET: Admin/MathStudent public ActionResult Index() { GroupMathDao bdDao = new GroupMathDao(); ViewBag.lstGroupMath = bdDao.ToList(); MathStudentDao db = new MathStudentDao(); return(View(db.ToList())); }
// 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)); }