public async Task <ActionResult> UpdateProfileInfo(ProfileDataForEditDTOin userData)
 {
     if (await this.userDataService.EditUserData(userData))
     {
         return(NoContent());
     }
     return(BadRequest());
 }
示例#2
0
        public async Task <bool> EditUserData(ProfileDataForEditDTOin userData)
        {
            var foundUser = await this.uManager.FindByNameAsync(userData.UserName);

            if (foundUser is null)
            {
                return(false);
            }
            if (await uManager.CheckPasswordAsync(foundUser, userData.Password))
            {
                foundUser.Gender        = Enum.Parse <Gender>(userData.Gender[0].ToString().ToUpper() + userData.Gender.Substring(1));
                foundUser.FirstName     = userData.FirstName;
                foundUser.LastName      = userData.LastName;
                foundUser.Email         = userData.Email;
                foundUser.AvatarPicture = userData.AvatarPicture;
                foundUser.Description   = userData.Description;
                await uManager.UpdateAsync(foundUser);

                return(true);
            }
            return(false);
        }