예제 #1
0
        public ActionResult CreateLyLich()
        {
            ViewBag.HocHam = unitOfWork.HocHamRepository.Get();
            ViewBag.HocVi  = unitOfWork.HocViRepository.Get();
            var vm = new tb_LyLich();

            return(View(vm));
        }
예제 #2
0
 public ActionResult EditLyLich(tb_LyLich model)
 {
     if (ModelState.IsValid)
     {
         unitOfWork.LyLichRepository.Update(model);
         unitOfWork.Save();
         return(RedirectToAction(nameof(DanhSachLyLich)));
     }
     return(View(model));
 }
예제 #3
0
        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));
        }