public Gear Save(Gear existing) { var gear = existing ?? new Gear(); gear.Name = this.Name; gear.Price = MoneyAmounts.ParsePrice(this.Price); gear.Weight = WeightAmounts.ParseWeight(this.Weight); gear.Category = (GearCategory)this.Category; gear.Id = this.Id; gear.Description = this.Description; gear.Source.Id = this.Source; if (!string.IsNullOrEmpty(this.EnglishName)) { gear.OpenLocalization().AddLocalizedEntry(DataSetLanguages.English, "name", this.EnglishName); } return(gear); }
public static ValidationResult ValidatePrice(string price) { string message; return((MoneyAmounts.ParsePrice(price, out message) != null && !string.IsNullOrEmpty(price)) ? ValidationResult.Success : new ValidationResult(message)); }