public IHttpActionResult PutN1Data(int id, N1Data n1Data) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != n1Data.Id) { return(BadRequest()); } db.Entry(n1Data).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!N1DataExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetN1Data(int id) { N1Data n1Data = db.N1Data.Find(id); if (n1Data == null) { return(NotFound()); } return(Ok(n1Data)); }
public IHttpActionResult PostN1Data(N1Data n1Data) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.N1Data.Add(n1Data); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = n1Data.Id }, n1Data)); }
public IHttpActionResult DeleteN1Data(int id) { N1Data n1Data = db.N1Data.Find(id); if (n1Data == null) { return(NotFound()); } db.N1Data.Remove(n1Data); db.SaveChanges(); return(Ok(n1Data)); }