Esempio n. 1
0
 // 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);
 }
Esempio n. 2
0
 //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);
 }
Esempio n. 3
0
 // 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);
 }
Esempio n. 4
0
 // 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);
 }
Esempio n. 5
0
 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();
         }
     }
 }
Esempio n. 6
0
 // 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);
 }