public async Task Update(Profile profile) { Ensure.NotNull(profile, nameof(profile)); Ensure.IsTrue(!profile.IsPredefined, "Can't update predefined profile"); Ensure.IsTrue(profile.IsColorCodeValid()); ApiResponseResult <ProfileResponse> response = await HandleErrors( () => _apiClient.UpdateProfile(profile.ExternalId, ToApiProfile(profile))); UpdatePropertiesFromApiProfile(profile, response.Value.Profile); }
public static bool IsValid(this Profile profile) { if (profile == null) { return(false); } // The old ServerId (mapped to LogicalID on the API) value might be not mapped by the profile migration. if (!string.IsNullOrEmpty(profile.ServerId) && profile.ServerId.Length < 5) { return(false); } return(profile.IsColorCodeValid()); }