예제 #1
0
        public bool EditUser(UserUpdateModel userUpdateModel)
        {
            var user = userRepository.GetById(userUpdateModel.Id);

            if (userUpdateModel != null && user != null)
            {
                user.FirstName  = userUpdateModel.FirstName;
                user.SecondName = userUpdateModel.SecondName;
                user.Username   = userUpdateModel.Username;
                userRepository.Update(user);
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
 public BaseResponseModel PostUserEdit([FromBody] UserUpdateModel userUpdateModel)
 {
     try
     {
         var result = userService.EditUser(userUpdateModel);
         if (result)
         {
             return(new SuccessResponseModel <bool>(result));
         }
         else
         {
             return(new BaseResponseModel(ReadOnlyValues.UnexpectedErrorMessage));
         }
     }
     catch (Exception ex)
     {
         return(new BaseResponseModel(ex.Message));
     }
 }
예제 #3
0
 public IActionResult Edit(UserUpdate userUpdate)
 {
     if (ModelState.IsValid)
     {
         var editRes = Post <bool>(MyApiRequestModel.PostEditUser, userUpdate, withToken: true);
         var checkEditBaseControllerError = CheckBaseControllerError(editRes);
         if (checkEditBaseControllerError == null)
         {
             return(View(ReadOnlyValues.HomeLoginViewPath));
         }
         else
         {
             return(Error(checkEditBaseControllerError));
         }
     }
     else
     {
         return(Edit());
     }
 }