public async Task CreateProfileAsync(string email, string userName, string userId) { var profile = new Profile { Email = email, Username = userName, Created = DateTime.Now, BirthDate = null, UserId = userId }; await _repositoryProfile.AddAsync(profile); await _repositoryProfile.SaveChangesAsync(); }
static bool ValidateToUpdate(Profile userProfile, ProfileDto profileDto) { bool updated = false; if (userProfile.FirstName != profileDto.FirstName && profileDto.FirstName != null) { userProfile.FirstName = profileDto.FirstName; updated = true; } if (userProfile.LastName != profileDto.LastName && profileDto.LastName != null) { userProfile.LastName = profileDto.LastName; updated = true; } if (userProfile.Age != profileDto.Age && profileDto.Age != null) { userProfile.Age = profileDto.Age; updated = true; } if (userProfile.BirthDate != profileDto.BirthDate && profileDto.BirthDate != null) { userProfile.BirthDate = profileDto.BirthDate; updated = true; } if (userProfile.Telegram != profileDto.Telegram && profileDto.Telegram != null) { userProfile.Telegram = profileDto.Telegram; updated = true; } if (userProfile.SocialNetwork != profileDto.SocialNetwork && profileDto.SocialNetwork != null) { userProfile.SocialNetwork = profileDto.SocialNetwork; updated = true; } if (userProfile.Image != profileDto.Image && profileDto.Image != null) { userProfile.Image = profileDto.Image; updated = true; } return(updated); }