public ActionResult Edit([Bind(Include = "id,hospital")] DocRegistraton docregistraton) { if (ModelState.IsValid) { int hosid = Convert.ToInt32(docregistraton.hospital); var gethos = (from e in db.DocHospitals where e.id == hosid select e).FirstOrDefault(); var getdoc = (from e in db.DocRegistratons where e.id == docregistraton.id select e).FirstOrDefault(); getdoc.hospital = gethos.Hospitalname; getdoc.address = gethos.Hospitaladdress; getdoc.state = gethos.State; getdoc.hostype = gethos.id; getdoc.approve = 1; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(docregistraton)); }
public ActionResult DeleteConfirmed(int id) { DocRegistraton docregistraton = db.DocRegistratons.Find(id); db.DocRegistratons.Remove(docregistraton); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: /Doctors/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DocRegistraton docregistraton = db.DocRegistratons.Find(id); if (docregistraton == null) { return(HttpNotFound()); } return(View(docregistraton)); }
public ActionResult DocRegister(DocRegistraton collect) { string username = Request.Form["name"].ToLower(); string pass1 = Request.Form["password"].ToLower(); string pass2 = Request.Form["password1"].ToLower(); if (pass1 != pass2) { ViewBag.error = "ERROR: PASSWORDS ENTERED NOT THE SAME"; return(View()); } var userdata = (from e in db.DocRegistratons where e.docusername == username select e).FirstOrDefault(); if (userdata != null) { ViewBag.error = "ERROR: USERNAME ALREADY EXISTS"; return(View()); } else { collect.docusername = username; collect.docpassword = pass1; Session["name"] = username; Session["password"] = pass1; Allstatic.Userlogin = "******"; Allstatic.DocRegister = collect; db.DocRegistratons.Add(collect); db.SaveChanges(); return(RedirectToAction("DocProfile")); } return(View()); }
// GET: /Doctors/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DocRegistraton docregistraton = db.DocRegistratons.Find(id); if (docregistraton == null) { return(HttpNotFound()); } var hosnames = (from e in db.DocHospitals select e).ToList(); ViewBag.hosnames = hosnames; return(View(docregistraton)); }
public ActionResult Doclogin(DocRegistraton collect) { string username = Request.Form["name"].ToLower(); string pass1 = Request.Form["password"].ToLower(); if (username == "" || pass1 == "") { ViewBag.error = "ERROR: ALL DATA MUST BE FILLED"; return(View()); } var userdata = (from e in db.DocRegistratons where e.docusername == username && e.docpassword == pass1 select e).FirstOrDefault(); if (userdata == null) { ViewBag.error = "ERROR: USERNAME DOSEN'T EXISTS, PLEASE TRY AGAIN"; return(View()); } else { Session["name"] = username; Session["password"] = pass1; var userinfo = userdata; Allstatic.DocRegister = userinfo; return(RedirectToAction("DocProfile")); } return(View()); }