コード例 #1
0
 public void DeleteSection(SectionEntity entity)
 {
     try
     {
         _sectionReposytory.Delete(entity.ToDalSection());
         _unitOfWorkuow.Commit();
     }
     catch (Exception e)
     {
         Log.LogError(e);
     }
 }
コード例 #2
0
 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();
 }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
 public void UpdateSection(SectionEntity section)
 {
     sectionRepository.Update(section.ToDalSection());
     uow.Commit();
 }