public async Task <ActionResult <PetshopOA.Shared.Petshop> > PostPetshop(PetshopOA.Shared.Petshop petshop) { _context.Petshops.Add(petshop); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPetshop", new { id = petshop.Id }, petshop)); }
public async Task <IActionResult> PutPetshop(int id, PetshopOA.Shared.Petshop petshop) { if (id != petshop.Id) { return(BadRequest()); } _context.Entry(petshop).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PetshopExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }