Exemplo n.º 1
0
        public async Task UpdateAsync(ILoanOffer loanOffer)
        {
            using (var db = new LoanOfferContext())
            {
                var loan = await db.LoanOffers.FirstOrDefaultAsync(x => x.Id == loanOffer.Id.Value);

                if (loan == null)
                {
                    return;
                }

                loan.RequestedLoanAmount = loanOffer.RequestedLoanAmount.Value;
                await db.SaveChangesAsync();
            }
        }
Exemplo n.º 2
0
 public async Task AddAsync(ILoanOffer loanOffer)
 {
     using (var db = new LoanOfferContext())
     {
         db.LoanOffers.Add(
             new LoanOfferDTO
         {
             Id                  = loanOffer.Id.Value,
             Pesel               = loanOffer.PeselNumber.Value,
             EmailAddress        = loanOffer.EmailAddress.Value,
             MaxLoanAmount       = loanOffer.MaxLoanAmount.Value,
             RequestedLoanAmount = loanOffer.RequestedLoanAmount.Value
         }
             );
         await db.SaveChangesAsync();
     }
 }