public HttpResponseMessage PostPatient(UyeBilgisi uye) { try { using (var db = new HastaneDBEntities()) { tbl_Patient Patient = db.tbl_Patient.FirstOrDefault(x => x.Tckn == uye.TcNo); if (Patient != null) { if (Patient.PatientPassword == uye.Password) { return(Request.CreateResponse(HttpStatusCode.OK, Patient)); } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Yanlış şifre")); } } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Bulunamadı")); } } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex)); } }
public HttpResponseMessage Put(tbl_Patient patient) { try { using (var db = new HastaneDBEntities()) { tbl_Patient Patient = db.tbl_Patient.FirstOrDefault(x => x.PatientID == patient.PatientID); if (Patient != null) { Patient.PaitentMail = patient.PaitentMail; Patient.PaitentName = patient.PaitentName; Patient.PaitentSurname = patient.PaitentSurname; Patient.PatientPassword = patient.PatientPassword; if (db.SaveChanges() > 0) { return(Request.CreateResponse(HttpStatusCode.OK, "Güncellendi")); } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Güncelleme yapi1lamadi")); } } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Bulunamadı")); } } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex)); } }
public ActionResult DeleteConfirmed(int id) { tbl_Patient tbl_Patient = db.tbl_Patient.Find(id); db.tbl_Patient.Remove(tbl_Patient); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name,Address,ChiefComplains,Age,Sex,Mrno")] tbl_Patient tbl_Patient) { if (ModelState.IsValid) { db.Entry(tbl_Patient).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbl_Patient)); }
public ActionResult Edit([Bind(Include = "id,name,phone,remarks")] tbl_Patient tbl_Patient) { if (ModelState.IsValid) { db.Entry(tbl_Patient).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbl_Patient)); }
public ActionResult Create([Bind(Include = "Id,Name,Address,ChiefComplains,Age,Sex,Mrno")] tbl_Patient tbl_Patient) { if (ModelState.IsValid) { db.tbl_Patient.Add(tbl_Patient); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbl_Patient)); }
public ActionResult Create([Bind(Include = "id,name,phone,remarks")] tbl_Patient tbl_Patient) { if (ModelState.IsValid) { db.tbl_Patient.Add(tbl_Patient); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbl_Patient)); }
// GET: tbl_Patient/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tbl_Patient tbl_Patient = db.tbl_Patient.Find(id); if (tbl_Patient == null) { return(HttpNotFound()); } return(View(tbl_Patient)); }
public HttpResponseMessage PostKullanıcı(Id id) { using (var db = new HastaneDBEntities()) { try { tbl_Doctor Doctor = new tbl_Doctor(); tbl_Admin Admin = new tbl_Admin(); tbl_HospitalManager Manager = new tbl_HospitalManager(); tbl_Patient Patient = new tbl_Patient(); Patient = db.tbl_Patient.FirstOrDefault(x => x.PatientID == id.id); Doctor = db.tbl_Doctor.FirstOrDefault(x => x.DoctorID == id.id); Admin = db.tbl_Admin.FirstOrDefault(x => x.AdminID == id.id); Manager = db.tbl_HospitalManager.FirstOrDefault(x => x.ManagerID == id.id); if (Patient != null) { return(Request.CreateResponse(HttpStatusCode.OK, Patient)); } if (Doctor != null) { return(Request.CreateResponse(HttpStatusCode.OK, Doctor)); } if (Admin != null) { return(Request.CreateResponse(HttpStatusCode.OK, Admin)); } if (Manager != null) { return(Request.CreateResponse(HttpStatusCode.OK, Manager)); } else { return(Request.CreateResponse(HttpStatusCode.BadRequest, "Id kullanılmamakta")); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex)); } } }
public HttpResponseMessage HastaPost(tbl_Patient patient) { try { using (var db = new HastaneDBEntities()) { tbl_Patient Patient = db.tbl_Patient.FirstOrDefault(x => x.Tckn == patient.Tckn); if (Patient != null) { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Bu Tc kullanılmakta")); } else { db.tbl_Patient.Add(patient); db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, patient)); } } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex)); } }