public void SetCustomField(string name, string value) { var field = CustomFields.FirstOrDefault(f => f.Name == name); if (field == null) { field = new BrandCustomField(name, value); CustomFields.Add(field); } else { field.Value = value; } }
public void SetCustomField(string name, string value) { var field = CustomFields.FirstOrDefault(f => f.Name == name); if (field == null) { field = new BrandCustomField(name, value); CustomFields.Add(field); } else { field.Value = value; } }
public void UpdateTo(Brand brand) { brand.Id = this.Id; brand.Name = (this.Name ?? string.Empty).Trim(); brand.Description = (this.Description ?? string.Empty).Trim(); brand.Logo = (this.Logo ?? string.Empty).Trim(); if(this.CustomFields != null && this.CustomFields.Count > 0) { brand.CustomFields = new List<BrandCustomField>(); foreach (var cfm in this.CustomFields) { var cf = new BrandCustomField(); cf.BrandId = this.Id; cf.Name = cfm.Name; cf.Value = cfm.Value; brand.CustomFields.Add(cf); } } }