Beispiel #1
0
        /// <summary>
        /// Save the amount to the database.
        /// </summary>
        /// <param name="amount">The amount that will be saved.</param>
        public void SaveAmount(Amount amount)
        {
            ICollection <ValidationResult> validationResults;

            if (!amount.Validate(out validationResults))
            {
                var ex = new ValidationException(Validation_Object_Error);
                ex.Data.Add("ValidationResult", validationResults);
                throw ex;
            }

            if (amount.AmountID == 0)
            {
                AmountDAL.InsertAmount(amount);
            }
            else
            {
                AmountDAL.UpdateAmount(amount);
            }
        }
        /// <summary>
        /// Save the amount to the database.
        /// </summary>
        /// <param name="amount">The amount that will be saved.</param>
        public void SaveAmount(Amount amount)
        {
            ICollection<ValidationResult> validationResults;

            if (!amount.Validate(out validationResults))
            {
                var ex = new ValidationException(Validation_Object_Error);
                ex.Data.Add("ValidationResult", validationResults);
                throw ex;
            }

            if (amount.AmountID == 0)
            {
                AmountDAL.InsertAmount(amount);
            }
            else
            {
                AmountDAL.UpdateAmount(amount);
            }
        }