Exemplo n.º 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);
            }
        }
Exemplo n.º 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));
     }
 }
Exemplo n.º 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());
     }
 }