Esempio n. 1
0
 public Loan GetById(int id)
 {
     using (var ctx = new MicrozayimContext())
     {
         return(ctx.Loans.Include(x => x.LoanTransactions)
                .FirstOrDefault(x => x.Id == id));
     }
 }
Esempio n. 2
0
 public void CreateLoan(Loan model)
 {
     using (var ctx = new MicrozayimContext())
     {
         ctx.Loans.Add(model);
         ctx.SaveChanges();
     }
 }
Esempio n. 3
0
 public IReadOnlyCollection <Loan> GetAll()
 {
     using (var ctx = new MicrozayimContext())
     {
         return(ctx.Loans
                .AsNoTracking()
                .ToList());
     }
 }
Esempio n. 4
0
 public void UpdateLoan(Loan model)
 {
     using (var ctx = new MicrozayimContext())
     {
         var upAmount = ctx.Loans.FirstOrDefault(x => x.Id == model.Id);
         upAmount.Amount = model.Amount;
         upAmount.Status = model.Status;
         ctx.SaveChanges();
     }
 }