public async Task <int> AddPurchase(Purchase purchase)
        {
            using (var context = new PurchaseTrackerContext())
            {
                context.Purchase.Add(purchase);

                return(await context.SaveChangesAsync());
            }
        }
        public async Task <int> DeleteByID(int purchaseID)
        {
            using (var context = new PurchaseTrackerContext())
            {
                var purchase = await context.Purchase.FindAsync(purchaseID);

                context.Entry(purchase).State = EntityState.Deleted;

                return(await context.SaveChangesAsync());
            }
        }
        public async Task <int> UpdatePurchase(Purchase purchase)
        {
            using (var context = new PurchaseTrackerContext())
            {
                var updatePurchase = await context.Purchase.FindAsync(purchase.PurchaseId);

                context.Entry(updatePurchase).CurrentValues.SetValues(purchase);

                return(await context.SaveChangesAsync());
            }
        }