private async Task ValidationUpdateVmAsync(UserAccessDto userAccessDto) { var validationResultVm = await _userAccessDtoUpdateValidationService .ValidationAsync(userAccessDto); AddErrors(validationResultVm); }
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 }); } }
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); }
public async Task <IActionResult> _Update(UserAccessDto userAccessDto) { await ValidationUpdateVmAsync(userAccessDto); if (HasError) { return(RedirectToAction("Index")); } await _userAccessService.UpdateAsync(userAccessDto); return(RedirectToAction("Index")); }
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")); }
public IActionResult UpdateUserAccess([FromBody] UserAccessDto data) { var result = _userService.UpdateUserAccess(data); return(GetStatusCodeResult(result)); }