public IHttpActionResult PutCarStock(int id, CarStock carStock) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != carStock.Id) { return(BadRequest()); } db.Entry(carStock).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CarStockExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetCarStock(int id) { CarStock carStock = db.CarStock.Find(id); if (carStock == null) { return(NotFound()); } return(Ok(carStock)); }
public IHttpActionResult PostCarStock(CarStock carStock) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.CarStock.Add(carStock); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = carStock.Id }, carStock)); }
public IHttpActionResult DeleteCarStock(int id) { CarStock carStock = db.CarStock.Find(id); if (carStock == null) { return(NotFound()); } db.CarStock.Remove(carStock); db.SaveChanges(); return(Ok(carStock)); }
private void detach_CarStocks(CarStock entity) { this.SendPropertyChanging(); entity.CarModel = null; }
private void attach_CarStocks(CarStock entity) { this.SendPropertyChanging(); entity.CarModel = this; }
partial void DeleteCarStock(CarStock instance);
partial void UpdateCarStock(CarStock instance);
partial void InsertCarStock(CarStock instance);