public IActionResult Post([FromBody] CreateUserRequest createUser)
        {
            if (createUser.Name.Equals("") || createUser.Surname.Equals("") || createUser.Email.Equals("") || createUser.Password.Equals(""))
            {
                return(BadRequest("Missing or invalid data!"));
            }
            else
            {
                if (userRepository.FindByEmail(createUser.Email))
                {
                    return(Conflict("User with this email is existing in database!"));
                }
                else
                {
                    createUser.Password = BCryptUtilities.encodePassword(createUser.Password);

                    return(Ok(userRepository.Create(createUser.ReturnUser())));
                }
            }
        }
 public IActionResult Update([FromBody] CreateUpdateUserRequest user, string email)
 {
     if (userRepository.FindByEmail(email))
     {
         User editedUser = userRepository.GetUserByEmail(email);
         if (BCryptUtilities.passwordMatch(user.OldPassword, editedUser.Password))
         {
             editedUser.Password = BCryptUtilities.encodePassword(user.NewPassword);
             editedUser.Name     = user.Name;
             editedUser.Surname  = user.Surname;
             return(Ok(userRepository.Update(editedUser)));
         }
         else
         {
             return(BadRequest("Passwords don't match!"));
         }
     }
     else
     {
         return(BadRequest("User with this login doesn't exist in database!"));
     }
 }