public IHttpActionResult GetCust(long id) { CustX cust = db.Custs.FirstOrDefault(x => x.Id == id); if (cust == null) { return(NotFound()); } return(Ok(cust)); }
public IHttpActionResult PostCust(CustX cust) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Custs.Add(cust); return(CreatedAtRoute("DefaultApi", new { id = cust.Id }, cust)); }
public IHttpActionResult PutCust(long id, CustX cust) { CustX Cust_curr = db.Custs.FirstOrDefault(x => x.Id == id); if (Cust_curr == null) { return(NotFound()); } Cust_curr = cust; return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult DeleteCust(long id) { CustX cust = db.Custs.FirstOrDefault(e => e.Id == id); if (cust == null) { return(NotFound()); } db.Custs.Remove(cust); return(Ok(cust)); }