public async Task <bool> Save(ICurrency currency, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (currency == null)
            {
                return(false);
            }
            cancellationToken.ThrowIfCancellationRequested();
            bool result;

            if (currency.Guid == Guid.Empty)
            {
                currency.Guid = Guid.NewGuid();

                result = dbCurrency.Create(
                    currency.Guid,
                    currency.Title,
                    currency.Code,
                    currency.SymbolLeft,
                    currency.SymbolRight,
                    currency.DecimalPointChar,
                    currency.ThousandsPointChar,
                    currency.DecimalPlaces,
                    currency.Value,
                    currency.LastModified,
                    currency.Created);
            }
            else
            {
                result = dbCurrency.Update(
                    currency.Guid,
                    currency.Title,
                    currency.Code,
                    currency.SymbolLeft,
                    currency.SymbolRight,
                    currency.DecimalPointChar,
                    currency.ThousandsPointChar,
                    currency.DecimalPlaces,
                    currency.Value,
                    currency.LastModified);
            }
            return(result);
        }
Beispiel #2
0
        public async Task <bool> Save(ICurrency currency)
        {
            if (currency == null)
            {
                return(false);
            }
            bool result;

            if (currency.Guid == Guid.Empty)
            {
                currency.Guid = Guid.NewGuid();

                result = dbCurrency.Create(
                    currency.Guid,
                    currency.Title,
                    currency.Code,
                    currency.SymbolLeft,
                    currency.SymbolRight,
                    currency.DecimalPointChar,
                    currency.ThousandsPointChar,
                    currency.DecimalPlaces,
                    currency.Value,
                    currency.LastModified,
                    currency.Created);
            }
            else
            {
                result = dbCurrency.Update(
                    currency.Guid,
                    currency.Title,
                    currency.Code,
                    currency.SymbolLeft,
                    currency.SymbolRight,
                    currency.DecimalPointChar,
                    currency.ThousandsPointChar,
                    currency.DecimalPlaces,
                    currency.Value,
                    currency.LastModified);
            }
            return(result);
        }