Ejemplo n.º 1
0
        public void Save(AuthContext context)
        {
            if (saveMask == AccountCurrencySaveMask.None)
            {
                return;
            }

            var model = new AccountCurrencyModel
            {
                Id         = accountId,
                CurrencyId = (byte)CurrencyId,
                Amount     = Amount
            };

            if ((saveMask & AccountCurrencySaveMask.Create) != 0)
            {
                context.Add(model);
            }
            else if ((saveMask & AccountCurrencySaveMask.Amount) != 0)
            {
                EntityEntry <AccountCurrencyModel> entity = context.Attach(model);
                entity.Property(p => p.Amount).IsModified = true;
            }

            saveMask = AccountCurrencySaveMask.None;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a new <see cref="AccountCurrency"/> from an <see cref="AccountCurrencyModel"/>
        /// </summary>
        public AccountCurrency(AccountCurrencyModel model)
        {
            accountId  = model.Id;
            CurrencyId = (AccountCurrencyType)model.CurrencyId;
            Amount     = model.Amount;
            Entry      = GameTableManager.AccountCurrencyType.GetEntry((ulong)CurrencyId);

            saveMask = AccountCurrencySaveMask.None;
        }