예제 #1
0
        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);
        }
예제 #2
0
        public static ValidationResult ValidatePrice(string price)
        {
            string message;

            return((MoneyAmounts.ParsePrice(price, out message) != null && !string.IsNullOrEmpty(price)) ? ValidationResult.Success : new ValidationResult(message));
        }