//[ValidateAntiForgeryToken] public ActionResult Create(Appointments appointment) { if (ModelState.IsValid) { db.Appointments.Add(appointment); db.SaveChanges(); return(RedirectToAction("Index", "Appointments")); } List <Doctors> list = new List <Doctors>(); list = (from t in _context.Doctors select t).ToList(); list.Insert(0, new Doctors { DoctorId = 0, Name = "" }); ViewBag.message = new SelectList(list, "DoctorId", "Name"); List <Patients> plist = new List <Patients>(); plist = (from p in _context.Patients select p).ToList(); plist.Insert(0, new Patients { PatientId = 0, Name = "" }); ViewBag.listofitem = new SelectList(plist, "PatientId", "Name"); return(View()); }
public IActionResult RegisterDoctor(DoctorViewModel doctor) { string uniqueFileName = UploadedFile(doctor); if (ModelState.IsValid) { Doctor newdoctor = new Doctor { DocName = doctor.DocName, Phone = doctor.Phone, Gender = doctor.Gender, Photo = uniqueFileName, Specialization = doctor.Specialization, Email = doctor.Email, Password = doctor.Password }; hospitalDBContext.Doctor.Add(newdoctor); hospitalDBContext.SaveChanges(); return(RedirectToAction("DoctorHome", new RouteValueDictionary( new { controller = "Doctor", action = "DoctorHome", Id = newdoctor.DocId }))); } else { return(RedirectToAction()); } }
public ActionResult Create(Nurse nurse) { if (ModelState.IsValid) { db.Nurse.Add(nurse); db.SaveChanges(); return(RedirectToAction("Index", "Nurses")); } return(View(nurse)); }
// [ValidateAntiForgeryToken] public ActionResult Create(Patients patient) { if (ModelState.IsValid) { db.Patients.Add(patient); db.SaveChanges(); return(RedirectToAction("Index", "Patients")); } return(View()); }
public ActionResult Create([Bind(Include = "CauseTypeID,CauseTypeName")] CauseType causeType) { if (ModelState.IsValid) { db.CauseTypes.Add(causeType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(causeType)); }
public ActionResult Create([Bind(Include = "TreatmentStatusID,Status")] TreatmentStatus treatmentStatus) { if (ModelState.IsValid) { db._Treatmentstatus.Add(treatmentStatus); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(treatmentStatus)); }
public ActionResult Create([Bind(Include = "StaffID,FName,LName,Adress,PhoneNR,SSN,HierDate,_Department")] Staff staff) { if (ModelState.IsValid) { db._Staff.Add(staff); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(staff)); }
public ActionResult Create([Bind(Include = "WhatsDoneID,Description")] WhatsDone whatsDone) { if (ModelState.IsValid) { db._WhatsDone.Add(whatsDone); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(whatsDone)); }
public ActionResult Create([Bind(Include = "PatientID,FName,LName,Adress,PhoneNR,SSN,CeckInHospital")] Patient patient) { if (ModelState.IsValid) { db._Patient.Add(patient); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(patient)); }
public ActionResult Create(Doctors doctor) { if (ModelState.IsValid) { db.Doctors.Add(doctor); db.SaveChanges(); return(RedirectToAction("Index", "Doctors")); } // return RedirectToAction("Index", "Doctors"); return(View()); }
public IActionResult Delete(int?Id) { var doc = HospitalDBContext.Doctor.SingleOrDefault(i => i.DocId == Id); if (Id != null && doc != null) { HospitalDBContext.Doctor.Remove(doc); HospitalDBContext.SaveChanges(); return(RedirectToAction("notFound", "Home")); } return(RedirectToAction()); }
public ActionResult Create(Clinic clinic) { try { HospitalDBContext.Clinic.Add(clinic); HospitalDBContext.SaveChanges(); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult Create([Bind(Include = "TreatmentID,Date,StillAlive,PatientID,WhatsDoneID,TreatmentStatusID")] Treatment treatment) { if (ModelState.IsValid) { db._Treatment.Add(treatment); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PatientID = new SelectList(db._Patient, "PatientID", "FName", treatment.PatientID); ViewBag.TreatmentStatusID = new SelectList(db._Treatmentstatus, "TreatmentStatusID", "Status", treatment.TreatmentStatusID); ViewBag.WhatsDoneID = new SelectList(db._WhatsDone, "WhatsDoneID", "Description", treatment.WhatsDoneID); return(View(treatment)); }
public IActionResult Appointment(Appointment appointment) { Appointment app = new Appointment { PatientId = appointment.PatientId, DocId = appointment.DocId, Date = appointment.Date, Clinic = appointment.Clinic }; HospitalDBContext.Appointment.Add(app); HospitalDBContext.SaveChanges(); return(RedirectToAction("PatiientHome", new RouteValueDictionary( new { controller = "Patient", action = "PatiientHome", Id = app.PatientId }))); }
public ActionResult Create(Attendance attendance) { if (ModelState.IsValid) { db.Attendance.Add(attendance); db.SaveChanges(); return(RedirectToAction("Index", "Attendances")); //Index ->methodname , Attendences -> ControllerName } List <Patients> plist = new List <Patients>(); plist = (from p in _context.Patients select p).ToList(); plist.Insert(0, new Patients { PatientId = 0, Name = "" }); ViewBag.listofitem = new SelectList(plist, "PatientId", "Name"); return(View()); }
public bool registerPatient(Patient patient) { _ctx.Patients.Add(patient); return(Convert.ToBoolean(_ctx.SaveChanges())); }
public bool registerHospital(Hospital hospital) { _ctx.Hospitals.Add(hospital); return(Convert.ToBoolean(_ctx.SaveChanges())); }