public IHttpActionResult PutContacted_Person(int id, Contacted_Person contacted_Person) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != contacted_Person.Id) { return(BadRequest()); } db.Entry(contacted_Person).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Contacted_PersonExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostContacted_Person(Contacted_Person contacted_Person) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Contacted_Person.Add(contacted_Person); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = contacted_Person.Id }, contacted_Person)); }
public IHttpActionResult DeleteContacted_Person(int id) { Contacted_Person contacted_Person = db.Contacted_Person.Find(id); if (contacted_Person == null) { return(NotFound()); } db.Contacted_Person.Remove(contacted_Person); db.SaveChanges(); return(Ok(contacted_Person)); }