/// <summary> /// Enqueue <see cref="CostumeUnlock"/> to be deleted from the database. /// </summary> public void EnqueueDelete(bool set) { if (set) { saveMask |= CostumeUnlockSaveMask.Delete; } else { saveMask &= ~CostumeUnlockSaveMask.Delete; } }
public void Save(AuthContext context) { if (saveMask == CostumeUnlockSaveMask.None) { return; } var model = new AccountCostumeUnlockModel { Id = accountId, ItemId = ItemId }; if ((saveMask & CostumeUnlockSaveMask.Create) != 0) { context.Add(model); } else { context.Entry(model).State = EntityState.Deleted; } saveMask = CostumeUnlockSaveMask.None; }
/// <summary> /// Create a new <see cref="CostumeUnlock"/> from supplied item id. /// </summary> public CostumeUnlock(AccountModel account, uint itemId) { ItemId = itemId; accountId = account.Id; saveMask = CostumeUnlockSaveMask.Create; }