public async Task <IHttpActionResult> PostCustomer2177(Customer2177 customer2177) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Customer2177.Add(customer2177); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (Customer2177Exists(customer2177.CUSTOMERID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = customer2177.CUSTOMERID }, customer2177)); }
public async Task <IHttpActionResult> PutCustomer2177(int id, Customer2177 customer2177) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != customer2177.CUSTOMERID) { return(BadRequest()); } db.Entry(customer2177).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Customer2177Exists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetCustomer2177(int id) { Customer2177 customer2177 = await db.Customer2177.FindAsync(id); if (customer2177 == null) { return(NotFound()); } return(Ok(customer2177)); }
public async Task <IHttpActionResult> DeleteCustomer2177(int id) { Customer2177 customer2177 = await db.Customer2177.FindAsync(id); if (customer2177 == null) { return(NotFound()); } db.Customer2177.Remove(customer2177); await db.SaveChangesAsync(); return(Ok(customer2177)); }