// here we can add doctors public bool AddDocter(Doctor DR) { using (HMS_APIEntities hms = new HMS_APIEntities()) { hms.Doctors.Add(DR); hms.SaveChanges(); } return(true); }
//here we can register patient public bool PatientRegister(PatientRegister PR) { using (HMS_APIEntities hms = new HMS_APIEntities()) { hms.PatientRegisters.Add(PR); hms.SaveChanges(); } return(true); }
public bool Appoinment(PatientRegister SearchModel) { using (HMS_APIEntities hms = new HMS_APIEntities()) { // i put business logic in a (PatientRegister.cs) for sorting by Id,Name,Phone var business = new ProductBusinessLogic(); var model = business.PatientRegister(SearchModel); } return(true); }
// here we can delet patient record public bool DeleteDoctor(Doctor DR) { using (HMS_APIEntities hms = new HMS_APIEntities()) { Doctor DeleteDoctor = (from d in hms.Doctors where d.Id == DR.Id select d).FirstOrDefault(); hms.Doctors.Remove(DeleteDoctor); hms.SaveChanges(); } return(true); }
// here we can delet patient record public bool DeletePatient(PatientRegister PR) { using (HMS_APIEntities hms = new HMS_APIEntities()) { PatientRegister DeletePatient = (from c in hms.PatientRegisters where c.PatientId == PR.PatientId select c).FirstOrDefault(); hms.PatientRegisters.Remove(DeletePatient); hms.SaveChanges(); } return(true); }
public void UpdateDoctor(Doctor DR) { using (HMS_APIEntities hms = new HMS_APIEntities()) { int id = DR.Id; if (ModelState.IsValid) { DR.Id = id; hms.Entry(DR).State = EntityState.Modified; hms.SaveChanges(); } } }
// here we can update patient what i register in above method public bool UpdatePatient(PatientRegister PR) { using (HMS_APIEntities hms = new HMS_APIEntities()) { PatientRegister UpdatedPatient = (from p in hms.PatientRegisters where p.PatientId == PR.PatientId select p).FirstOrDefault(); UpdatedPatient.Name = PR.Name; UpdatedPatient.Phone = PR.Phone; UpdatedPatient.CNIC = PR.CNIC; hms.SaveChanges(); } return(true); }
public string GetAllDoctorSalries(int did) { using (HMS_APIEntities db = new HMS_APIEntities()) { string output = ""; var list = db.Doctors.Single(s => s.Id == did); if (list.Salary == null) { output = "--"; } else { output = String.Format("{0:0.##}", list.Salary); } return(output); } }
public PatientRegister() { Context = new HMS_APIEntities(); }