Esempio n. 1
0
        public ActionResult CreateGroup(UserGroupVeiwModel vw)
        {
            try
            {
                vw.Id = Guid.NewGuid();
                _userGroupVeiwModelBuilder.Save(vw);
                _auditLogViewModelBuilder.AddAuditLog(this.User.Identity.Name, "Create", "User Group", DateTime.Now);
                TempData["msg"] = "User Group Successfully Created";
                return RedirectToAction("list");
            }
            catch (DomainValidationException dve)
            {

                //string msg = ValidationSummary.DomainValidationErrors(dve);
                //ViewBag.msg = msg;
                ValidationSummary.DomainValidationErrors(dve,ModelState);
                return View();
            }
            catch (Exception ex)
            {
                ViewBag.msg = ex.Message;

                return View();
            }
        }
 public void Save(UserGroupVeiwModel userGroupVeiwModel)
 {
     UserGroup usergroup = new UserGroup(userGroupVeiwModel.Id)
     {
         Name = userGroupVeiwModel.Name,
         Descripition = userGroupVeiwModel.Description,
        
     };
     _userGroupRepository.Save(usergroup);
 }
        private UserGroupVeiwModel Map(UserGroup userGroup)
        {
            UserGroupVeiwModel vm = new UserGroupVeiwModel
                                        {
                                            Description=userGroup.Descripition,
                                            Id=userGroup.Id,
                                            Name=userGroup.Name,
                                            IsActive = userGroup._Status == EntityStatus.Active ? true : false
                                        };
            return vm;

        }