예제 #1
0
        private async Task ValidationUpdateVmAsync(UserAccessDto userAccessDto)
        {
            var validationResultVm = await _userAccessDtoUpdateValidationService
                                     .ValidationAsync(userAccessDto);

            AddErrors(validationResultVm);
        }
예제 #2
0
 public ResultMessage UpdateUserAccess(UserAccessDto userAccessDto)
 {
     try
     {
         var user = _unitOfWork.UsersRepository.Get(u => u.UserName == userAccessDto.Username).First();
         if (user == null)
         {
             return new ResultMessage {
                        Status = HttpStatusCode.InternalServerError, ErrorCode = (int)AuthenticationErrorsCodeEnum.UserDoesNotExist
             }
         }
         ;
         user.IsBlocked = userAccessDto.Blocked;
         _unitOfWork.UsersRepository.Update(user);
         _unitOfWork.Commit();
         return(new ResultMessage {
             Status = HttpStatusCode.OK
         });
     }
     catch (Exception ex)
     {
         _logger.LogError(ex, string.Empty);
         return(new ResultMessage {
             Status = HttpStatusCode.InternalServerError, ErrorCode = (int)AuthenticationErrorsCodeEnum.AuthenticationError
         });
     }
 }
예제 #3
0
        private async Task AppUserDtoInsertValidationAsync(UserAccessDto userAccessDto)
        {
            var validationResultVm = await _userAccessDtoInsertValidationService
                                     .ValidationAsync(userAccessDto);

            AddErrors(validationResultVm);
        }
        public async Task <ValidationResultVm> ValidationAsync(UserAccessDto appUserVm)
        {
            _userAccessDto = appUserVm;

            await DoValidationAsync();

            return(ValidationResultVm);
        }
예제 #5
0
        public async Task <IActionResult> _Update(UserAccessDto userAccessDto)
        {
            await ValidationUpdateVmAsync(userAccessDto);

            if (HasError)
            {
                return(RedirectToAction("Index"));
            }

            await _userAccessService.UpdateAsync(userAccessDto);

            return(RedirectToAction("Index"));
        }
예제 #6
0
        public async Task <IActionResult> _InsertAsync(UserAccessDto userAccessDto)
        {
            await AppUserDtoInsertValidationAsync(userAccessDto);

            if (HasError)
            {
                return(RedirectToAction("Index"));
            }

            await _userAccessService.InsertAsync(userAccessDto);

            SuccessMessage("UserAccess user is success");

            return(RedirectToAction("Index"));
        }
예제 #7
0
        public IActionResult UpdateUserAccess([FromBody] UserAccessDto data)
        {
            var result = _userService.UpdateUserAccess(data);

            return(GetStatusCodeResult(result));
        }