public ActionResult CreateSchoolLevel(ComSchoolLevelViewModel model) { if (model != null) { if (!String.IsNullOrEmpty(model.name)) { bool result = commonListUnitOfWork.CreateSchoolLevel(model.name, model.levelNum); if (result) { TempData["successmessage"] = "Tạo bằng cấp " + model.name + " thành công."; } else { TempData["errormessage"] = "Tạo bằng cấp " + model.name + " thất bại!"; } } else { TempData["errormessage"] = "Dữ liệu không hợp lệ!"; } } else { TempData["errormessage"] = "Có lỗi xảy ra!"; } return(RedirectToAction("SchoolLevelList")); }
public ActionResult SchoolLevelList() { ComSchoolLevelViewModel model = new ComSchoolLevelViewModel(); model.schoolLevels = commonListUnitOfWork.SchoolLevelRepository.Get(s => s.IsDeleted == false).OrderByDescending(s => s.LevelNum).AsEnumerable(); model.name = ""; return(View(model)); }