Esempio n. 1
0
        public void Save(CharacterContext context)
        {
            if (saveMask == SaveMask.None)
            {
                return;
            }

            var model = new CharacterEntitlementModel
            {
                Id            = characterId,
                EntitlementId = (byte)Type,
                Amount        = amount
            };

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

            saveMask = SaveMask.None;
        }
Esempio n. 2
0
 /// <summary>
 /// Create a new <see cref="CharacterEntitlement"/> from an existing database model.
 /// </summary>
 public CharacterEntitlement(CharacterEntitlementModel model, EntitlementEntry entry)
     : base(entry, model.Amount, false)
 {
     characterId = model.Id;
 }