public void SetupDb() { using (var context = new SpendingTrackContext(options)) { SpendingItem spendingItem1 = new SpendingItem() { Heading = headingList[0], Category = categoryList[0], Cost = costList[0], TripID = tripIDList[0], Currency = currencyList[0], CreatedAt = createdAtList[0], ReceiptID = receiptIDList[0], Note = noteList[0] }; SpendingItem spendingItem2 = new SpendingItem() { Heading = headingList[1], Category = categoryList[1], Cost = costList[1], TripID = tripIDList[1], Currency = currencyList[1], CreatedAt = createdAtList[1], ReceiptID = receiptIDList[1], Note = noteList[1] }; context.SpendingItem.Add(spendingItem1); context.SpendingItem.Add(spendingItem2); context.SaveChanges(); } }
public void ClearDb() { using (var context = new SpendingTrackContext(options)) { context.SpendingItem.RemoveRange(context.SpendingItem); context.SaveChanges(); }; }