Esempio n. 1
0
 public ActionResult Add(KhungModel modelKhung)
 {
     try
     {
         if (ModelState.IsValid)
         {
             _khungRepository.Insert(modelKhung);
             return(RedirectToAction("List"));
         }
     }
     catch (Exception ex)
     {
         _logService.Error($"Add - Message: {ex.Message}", ex);
     }
     return(View(modelKhung));
 }
Esempio n. 2
0
 public ActionResult Edit(long Id, KhungModel modelKhung)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var currentKhung = _khungRepository.FindById(Id);
             if (currentKhung != null && currentKhung.Id > 0)
             {
                 _khungRepository.Update(modelKhung);
                 return(RedirectToAction("List"));
             }
         }
     }
     catch (Exception ex)
     {
         _logService.Error($"Add - Message: {ex.Message}", ex);
     }
     return(View(modelKhung));
 }