public async Task <DomainResult> UpsertAsync( Guid userId, SecuritySettingsSection publications, SecuritySettingsSection friends) { var profile = await profileStorage.FindByIdAsync(userId); if (profile == null) { return(DomainResult.Error("User not found")); } var securitySettings = await securitySettingsStorage.FindByUserIdAsync(userId); if (securitySettings == null) { securitySettings = new SecuritySetting(userId, publications, friends); } else { securitySettings.Update(publications, friends); } await securitySettingsStorage.UpsertAsync(securitySettings); return(DomainResult.Success()); }
public SecuritySetting( Guid userId, SecuritySettingsSection posts, SecuritySettingsSection friends) { UserId = userId; Posts = posts; Friends = friends; }
public void Update(SecuritySettingsSection posts, SecuritySettingsSection friends) { Posts = posts; Friends = friends; }