예제 #1
0
        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 = await 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 = await dbCurrency.Update(
                    currency.Guid,
                    currency.Title,
                    currency.Code,
                    currency.SymbolLeft,
                    currency.SymbolRight,
                    currency.DecimalPointChar,
                    currency.ThousandsPointChar,
                    currency.DecimalPlaces,
                    currency.Value,
                    currency.LastModified);
            }

            return(result);
        }
예제 #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 = await 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 = await dbCurrency.Update(
                    currency.Guid,
                    currency.Title,
                    currency.Code,
                    currency.SymbolLeft,
                    currency.SymbolRight,
                    currency.DecimalPointChar,
                    currency.ThousandsPointChar,
                    currency.DecimalPlaces,
                    currency.Value,
                    currency.LastModified);
            }

            return(result);
        }