//Change this to IConsumerDebt public void SaveData(CreditCardModel ccData) { var ccTableData = new CreditCardTableData { VendorName = ccData.CardVendor, AccountNickName = ccData.CardNickname, CreditCardType = ccData.CardType, OwingBalance = ccData.CardBalance, CreditLine = ccData.CardBalance }; int CreditCardId = CreditCardDbService.Add(ccTableData); foreach (InterestRateModel item in ccData.InterestRates) { var interestData = new InterestRateTableData { CreditCardFK = CreditCardId, StartDate = item.StartDate, EndDate = item.EndDate, InterestRate = item.InterestRate }; InterestRateDbService.Add(interestData); } }
public void AddCreditCard() { var ccInfo = new CreditCardTableData() { CreditCardType = 1, VendorName = "Discover", AccountNickName = "My Rewards Card", CreditLine = 100, OwingBalance = 24.99f }; int CreditCardId; CreditCardId = CreditCardDbService.Add(ccInfo); var ccRate1 = new InterestRateTableData() { StartDate = new DateTime(2019, 04, 30, 0, 0, 0), EndDate = new DateTime(2020, 04, 30, 0, 0, 0), InterestRate = 0.3f, CreditCardFK = CreditCardId }; InterestRateDbService.Add(ccRate1); var ccRate2 = new InterestRateTableData() { StartDate = new DateTime(2018, 04, 30, 0, 0, 0), EndDate = new DateTime(2019, 04, 30, 0, 0, 0), InterestRate = 0.2f, CreditCardFK = CreditCardId }; InterestRateDbService.Add(ccRate2); }
public static void Edit(InterestRateTableData interestRate) { using var context = new SqliteContext(); var entity = context.InterestRates.Update(interestRate); entity.State = EntityState.Modified; context.SaveChanges(); }
public static void Delete(InterestRateTableData interestRate) { using var context = new SqliteContext(); var entity = context.InterestRates.Remove(interestRate); entity.State = EntityState.Deleted; context.SaveChanges(); }
public static void Add(InterestRateTableData interestRate) { using var context = new SqliteContext(); var entity = context.InterestRates.Add(interestRate); entity.State = EntityState.Added; context.SaveChanges(); }