public IHttpActionResult PutSeller(int id, Seller seller) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != seller.Id) { return BadRequest(); } db.Entry(seller).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SellerExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostSeller(Seller seller) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Sellers.Add(seller); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = seller.Id }, seller); }