예제 #1
0
        public async Task <SqlResponse> UpdateProfile(ProfileUpdateUser user, int actorId)
        {
            try
            {
                var prof = await sqlService.GetUser(actorId);

                if (prof == null)
                {
                    return(SqlResponse.NotFound);
                }

                var password = PasswordHash(user.Password, prof.Salt);
                if (password != prof.Password)
                {
                    return(SqlResponse.Unauthorized);
                }

                prof.FirstName    = Coalesce(user.FirstName, prof.FirstName, "User");
                prof.LastName     = Coalesce(user.LastName, prof.LastName, "name");
                prof.EmailAddress = Coalesce(user.Email, prof.EmailAddress, "*****@*****.**");

                return(await sqlService.UpdateProfile(prof));
            }
            catch (Exception ex)
            {
                logger.LogError(ex, "Error occurred during profile update.");
                return(SqlResponse.Error);
            }
        }
예제 #2
0
 public async Task <IActionResult> Update([FromBody] ProfileUpdateUser user)
 {
     //TODO: IMPLEMENT THIS
     return(null);
 }