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(); } }
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(); } }