public async Task <IActionResult> PutCat(long id, Cat cat) { if (id != cat.Id) { return(BadRequest()); } _context.Entry(cat).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CatExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Owner> > PostOwner(Owner owner) { _context.Owners.Add(owner); await _context.SaveChangesAsync(); return(CreatedAtAction("GetOwner", new { id = owner.Id }, owner)); }