public async Task <IActionResult> PutLoantable(decimal id, Loantable loantable) { if (id != loantable.KLoan) { return(BadRequest()); } _context.Entry(loantable).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LoantableExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Loantable> > PostLoantable(Loantable loantable) { _context.Loantables.Add(loantable); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (LoantableExists(loantable.KLoan)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetLoantable", new { id = loantable.KLoan }, loantable)); }