public ActionResult New(UserGroupViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var result = _userGroupService.Add(model);

            return(RedirectToAction("Index", "Result", new { state = result, style = "dialog" }));
        }
Exemple #2
0
        public async Task <ActionResult> AddGroup([FromBody] AddUserGroupDto groupDto)
        {
            if (!IsAvailableOperation())
            {
                return(BadRequest());
            }

            var newGroupId = await _userGroupService.Add(groupDto, UserId);

            return(Ok(newGroupId));
        }
 public JavaScriptResult Create(UserGroupViewModel userGroupvm)
 {
     try
     {
         _userGroupService.Add(Mapper.Map <UserGroup>(userGroupvm));
         return(JavaScript($"ShowResult('{"Data saved successfully."}','{"success"}','{"redirect"}','{"/APanel/UserGroup?companyId=" + userGroupvm.CompanyId + "&&branchId=" + userGroupvm.BranchId}')"));
     }
     catch (Exception ex)
     {
         return(JavaScript($"ShowResult('{ex.Message}','failure')"));
     }
 }
Exemple #4
0
        public IActionResult Add(UserGroupDTO UserGroupDTO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.GetErrorMessage()));
            }
            else
            {
                _iMapper = UserGroupMapping.GetMapper().CreateMapper();
                UserGroup userGroup = _iMapper.Map <UserGroupDTO, UserGroup>(UserGroupDTO);

                IResult result = _iUserGroupService.Add(userGroup);

                if (result.Success)
                {
                    return(Ok(result.Message));
                }
                return(BadRequest(result.Message));
            }
        }
Exemple #5
0
 public async Task <UserGroupEntity> Add(UserGroupEntity usergroup)
 {
     return(await _usergroupService.Add(usergroup));
 }