public void DeleteSection(SectionEntity entity) { try { _sectionReposytory.Delete(entity.ToDalSection()); _unitOfWorkuow.Commit(); } catch (Exception e) { Log.LogError(e); } }
public ActionResult Create(SectionUpdateViewModel viewModel) { try { if (ModelState.IsValid) { SectionEntity section = new SectionEntity() { Name = viewModel.Name, Info = viewModel.Description, }; sectionService.Create(section); return RedirectToAction("Index"); } } catch (InvalidOperationException e) { logger.Error(e.Message, e); return View("Error"); } return View(); }
public ActionResult Edit(int id, SectionUpdateViewModel viewModel) { try { if (ModelState.IsValid) { SectionEntity section = new SectionEntity() { Id = id, Name = viewModel.Name, Info = viewModel.Description, }; sectionService.Update(section); return RedirectToAction("Index"); } return RedirectToAction("Index"); } catch { return View(viewModel); } }
public void UpdateSection(SectionEntity section) { sectionRepository.Update(section.ToDalSection()); uow.Commit(); }