public async Task <IHttpActionResult> PutNG2_Cars(int id, NG2_Cars nG2_Cars) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != nG2_Cars.id) { return(BadRequest()); } db.Entry(nG2_Cars).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NG2_CarsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetNG2_Cars(int id) { NG2_Cars nG2_Cars = await db.NG2_Cars.FindAsync(id); if (nG2_Cars == null) { return(NotFound()); } return(Ok(nG2_Cars)); }
public async Task <IHttpActionResult> PostNG2_Cars(NG2_Cars nG2_Cars) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.NG2_Cars.Add(nG2_Cars); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = nG2_Cars.id }, nG2_Cars)); }
public async Task <IHttpActionResult> DeleteNG2_Cars(int id) { NG2_Cars nG2_Cars = await db.NG2_Cars.FindAsync(id); if (nG2_Cars == null) { return(NotFound()); } db.NG2_Cars.Remove(nG2_Cars); await db.SaveChangesAsync(); return(Ok(nG2_Cars)); }