public async Task <ActionResult <Tire> > PostTire(Tire tire) { this.db.Tires.Add(tire); await this.db.SaveChangesAsync(); return(CreatedAtAction("GetTire", new { id = tire.Id }, tire)); }
public async Task <IActionResult> PutTire(int id, Tire tire) { if (id != tire.Id) { return(BadRequest()); } this.db.Entry(tire).State = EntityState.Modified; try { await this.db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TireExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }