Пример #1
0
        public ActionResult AddADGroup(ADGroupViewModel aDGroupViewModel)
        {
            try
            {

                var aDGroup = Mapper.Map<ADGroupViewModel, ADGroup>(aDGroupViewModel);

                _aDGroupService.AddADGroup(aDGroup);

                ViewBag.Status = "AddComplete";

                return View(aDGroupViewModel);

            }
            catch (ValidationException vex)
            {
                ModelState.AddErrors(vex);
                return View();
            }
            catch (Exception ex)
            {
                TempData["Message"] = ScreenMessages.ErrorMessage("Standard", ex.Message);

                return RedirectToAction("Error", "Error");
            }
        }
Пример #2
0
        public ActionResult AddADGroup()
        {
            try
            {
                ADGroupViewModel viewModel = new ADGroupViewModel();

                ViewBag.Status = "AddStarted";

                return View(viewModel);
            }
            catch (Exception ex)
            {
                TempData["Message"] = ScreenMessages.ErrorMessage("Standard", ex.Message);

                return RedirectToAction("Error", "Error");
            }
        }
Пример #3
0
        public ActionResult EditADGroup(ADGroupViewModel aDGroupViewModel)
        {
            var aDGroup = Mapper.Map<ADGroupViewModel, ADGroup>(aDGroupViewModel);

            try
            {

                _aDGroupService.EditADGroup(aDGroup);

                var viewModel = Mapper.Map<ADGroup, ADGroupViewModel>(aDGroup);

                ViewBag.Message = ScreenMessages.ValidMessage("Group updated.");

                return View(viewModel);
            }
            catch (DataException ex)
            {
                TempData["Message"] = ScreenMessages.ErrorMessage("Standard", ex.Message);
            }

            return View();
        }