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)); }
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)); }