public ActionResult Create(MathStudent collection) { GroupMathDropDownList(collection.GroupMathsID); try { MathStudentDao bdDao = new MathStudentDao(); 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(MathStudent collection) { MathStudentDao bdDao = new MathStudentDao(); GroupMathDropDownList(collection.GroupMathsID); try { UserLogin us = (UserLogin)Session[SystemConsts.USER_SESSION]; collection.ModifiedBy = us.UserName; collection.ModifiedDate = Hepper.GetDateServer(); // ConvertExcelToXml convertXML = new ConvertExcelToXml(); //string xml = convertXML.GetXML(collection.Sources); // int i = 0; 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 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()); } }
// GET: Admin/MathStudent/Edit/5 public ActionResult Edit(long id) { MathStudentDao db = new MathStudentDao(); MathStudent mathStudent = db.FindByID(id); GroupMathDropDownList(mathStudent.GroupMathsID); return(View(mathStudent)); }
// GET: Admin/MathStudent public ActionResult Index() { GroupMathDao bdDao = new GroupMathDao(); ViewBag.lstGroupMath = bdDao.ToList(); MathStudentDao db = new MathStudentDao(); return(View(db.ToList())); }
public ActionResult Delete(long id) { try { // TODO: Add delete logic here MathStudentDao bdDao = new MathStudentDao(); bdDao.Delete(id); // SetAlert("Xóa thành công", "success"); return(RedirectToAction("Index")); } catch { // SetAlert("Không xóa được", "danger"); return(View()); } }
// GET: Admin/MathStudent/Details/5 public ActionResult Details(long id) { MathStudentDao db = new MathStudentDao(); return(View(db.FindByID(id))); }