public async Task <IHttpActionResult> PutdiseaseData(int id, diseaseData diseaseData) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != diseaseData.id) { return(BadRequest()); } db.Entry(diseaseData).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!diseaseDataExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult deleteDisease(int id) { diseaseData doctors = db.Diseases.Find(id); db.Diseases.Remove(doctors); db.SaveChanges(); return(RedirectToAction("viewDiseases")); }
public ActionResult editDisease([Bind(Include = "id,name,symptom1,symptom2,symptom3,symptom4,cure,desc")] diseaseData disease) { if (ModelState.IsValid) { db.Entry(disease).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("viewDiseases")); } return(View(disease)); }
public ActionResult addDiseases([Bind(Include = "id,name,symptom1,symptom2,symptom3,symptom4,cure,desc")] diseaseData data) { if (ModelState.IsValid) { db.Diseases.Add(data); db.SaveChanges(); return(RedirectToAction("viewDiseases")); } return(View(data)); }
public async Task <IHttpActionResult> GetdiseaseData(int id) { diseaseData diseaseData = await db.diseaseDatas.FindAsync(id); if (diseaseData == null) { return(NotFound()); } return(Ok(diseaseData)); }
public async Task <IHttpActionResult> PostdiseaseData(diseaseData diseaseData) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.diseaseDatas.Add(diseaseData); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = diseaseData.id }, diseaseData)); }
public ActionResult diseaseDetails(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } diseaseData patients = db.Diseases.Find(id); if (patients == null) { return(HttpNotFound()); } return(View(patients)); }
public async Task <IHttpActionResult> DeletediseaseData(int id) { diseaseData diseaseData = await db.diseaseDatas.FindAsync(id); if (diseaseData == null) { return(NotFound()); } db.diseaseDatas.Remove(diseaseData); await db.SaveChangesAsync(); return(Ok(diseaseData)); }
// GET : Doctors/edit/2 public ActionResult editDisease(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } diseaseData disease = db.Diseases.Find(id); if (disease == null) { return(HttpNotFound()); } return(View(disease)); }
// GET: Doctors/deleteDisease/5 public ActionResult deleteDisease(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } diseaseData doctors = db.Diseases.Find(id); if (doctors == null) { return(HttpNotFound()); } return(View(doctors)); }