public async Task <IActionResult> PutLoan(int id, Loan loan) { if (id != loan.Id) { return(BadRequest()); } _context.Entry(loan).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LoanExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <LoanFile> > PostLoan(LoanFile loan) { _context.LoanFiles.Add(loan); await _context.SaveChangesAsync(); return(CreatedAtAction("GetLoan", new { id = loan.Id }, loan)); }
public async Task <ActionResult <Loan> > PostLoan(Loan loan) { _context.Loans.Add(loan); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetLoan), new { id = loan.Id }, loan)); }
public async Task <ActionResult <LoanItem> > PostLoanItem(LoanItem loanItem) { _context.LoanItems.Add(loanItem); await _context.SaveChangesAsync(); return(CreatedAtAction("GetLoanItem", new { id = loanItem.id }, loanItem)); }
public async Task <ActionResult <LoanItem> > PostTodoItem(LoanItem item) { _context.LoanItems.Add(item); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetLoanItem), new { id = item.Id }, item)); }
public async Task <IActionResult> PutQuote(long id, [FromBody] Quote quote) { //if (id != quote.id) //{ // return BadRequest(); //} _context.Entry(quote).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!QuoteExists(id)) { return(NotFound()); } else { throw; } } return(Ok(quote)); }
public async Task AddAsync(TEntity entity) { using LoanContext context = new LoanContext(); await context.AddAsync(entity); await context.SaveChangesAsync(); }
public async Task UpdateAsync(TEntity entity) { using LoanContext context = new LoanContext(); context.Update(entity); await context.SaveChangesAsync(); }