public ActionResult CreateLyLich() { ViewBag.HocHam = unitOfWork.HocHamRepository.Get(); ViewBag.HocVi = unitOfWork.HocViRepository.Get(); var vm = new tb_LyLich(); return(View(vm)); }
public ActionResult EditLyLich(tb_LyLich model) { if (ModelState.IsValid) { unitOfWork.LyLichRepository.Update(model); unitOfWork.Save(); return(RedirectToAction(nameof(DanhSachLyLich))); } return(View(model)); }
public ActionResult CreateLyLich(tb_LyLich model) { var errors = ModelState.Values.SelectMany(v => v.Errors); ViewBag.HocHam = unitOfWork.HocHamRepository.Get(); ViewBag.HocVi = unitOfWork.HocViRepository.Get(); if (ModelState.IsValid) { unitOfWork.LyLichRepository.Insert(model); unitOfWork.Save(); return(RedirectToAction(nameof(DanhSachLyLich))); } return(View(model)); }