コード例 #1
0
        public async Task <ResponseEntity> editUser(UserJiraModelUpdate modelVm)
        {
            var userEdit = _useJiraRepository.GetSingleByConditionAsync("id", modelVm.id).Result;

            try
            {
                if (userEdit == null)
                {
                    return(new ResponseEntity(StatusCodeConstants.NOT_FOUND, MessageConstants.DELETE_ERROR, MessageConstants.MESSAGE_ERROR_404));
                }

                userEdit.name        = modelVm.name;
                userEdit.email       = modelVm.email;
                userEdit.passWord    = modelVm.passWord;
                userEdit.phoneNumber = modelVm.phoneNumber;
                userEdit.avatar      = "https://ui-avatars.com/api/?name=" + userEdit.name;
                await _useJiraRepository.UpdateAsync(modelVm.id, userEdit);


                return(new ResponseEntity(StatusCodeConstants.OK, MessageConstants.UPDATE_SUCCESS, MessageConstants.MESSAGE_SUCCESS_200));
            }
            catch (Exception err)
            {
                return(new ResponseEntity(StatusCodeConstants.OK, MessageConstants.UPDATE_ERROR, MessageConstants.MESSAGE_ERROR_400));
            }
        }
コード例 #2
0
 public async Task <IActionResult> editUser([FromBody] UserJiraModelUpdate model)
 {
     return(await _userService.editUser(model));
 }