Ejemplo n.º 1
0
 public Adddoctormodel Getupdatedoc(int SID)
 {
     using (hms2Entities mm = new hms2Entities())
     {
         var            request = mm.doctors.Where(x => x.ID == SID).FirstOrDefault();
         Adddoctormodel dcctr   = null;
         if (request != null)
         {
             dcctr = new Adddoctormodel()
             {
                 SID           = request.ID,
                 firstName     = request.FirstName,
                 lastName      = request.LastName,
                 qualification = request.qualification,
                 cellnum       = request.Cellnum,
                 cnic          = request.CNIC,
                 gender        = request.Gender,
                 nationality   = request.Nationality
             };
             return(dcctr);
         }
         else
         {
             return(dcctr);
         }
     }
 }
Ejemplo n.º 2
0
 public List <AddpatientModel> readstudents()
 {
     using (hms2Entities he = new hms2Entities())
     {
         var request = he.patients.ToList();
         List <AddpatientModel> List = request.Select(x => new AddpatientModel {
             pID = x.ID, firstName = x.FirstName, lastName = x.LastName, Disease = x.Disease, cellnum = x.Cellnum, cnic = x.CNIC, gender = x.Gender, nationality = x.Nationality
         }).ToList();
         return(List);
     }
 }
Ejemplo n.º 3
0
 public List <Adddoctormodel> readstudents()
 {
     using (hms2Entities mm = new hms2Entities())
     {
         var request = mm.doctors.ToList();
         List <Adddoctormodel> List = request.Select(x => new Adddoctormodel {
             SID = x.ID, firstName = x.FirstName, lastName = x.LastName, qualification = x.qualification, cellnum = x.Cellnum, cnic = x.CNIC, gender = x.Gender, nationality = x.Nationality
         }).ToList();
         return(List);
     }
 }
Ejemplo n.º 4
0
 public bool Deletedctr(int id)
 {
     using (hms2Entities mm = new hms2Entities())
     {
         var data = mm.doctors.Where(x => x.ID == id).FirstOrDefault();
         if (data != null)
         {
             mm.Entry(data).State = EntityState.Deleted;
             mm.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Ejemplo n.º 5
0
 public bool DeleteStd(int id)
 {
     using (hms2Entities db = new hms2Entities())
     {
         var data = db.patients.Where(x => x.ID == id).FirstOrDefault();
         if (data != null)
         {
             db.Entry(data).State = EntityState.Deleted;
             db.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Ejemplo n.º 6
0
        public int adddoctor(Adddoctormodel dd)
        {
            int ddID;

            using (hms2Entities mm = new hms2Entities())
            {
                doctor tbldoctor = new doctor();
                tbldoctor.FirstName     = dd.firstName;
                tbldoctor.LastName      = dd.lastName;
                tbldoctor.qualification = dd.qualification;
                tbldoctor.Cellnum       = dd.cellnum;
                tbldoctor.CNIC          = dd.cnic;
                tbldoctor.Gender        = dd.gender;
                tbldoctor.Nationality   = dd.nationality;

                mm.doctors.Add(tbldoctor);

                mm.SaveChanges();

                ddID = tbldoctor.ID;
            }
            return(ddID);
        }
Ejemplo n.º 7
0
        public int addpatient(AddpatientModel ad)
        {
            int adID;

            using (hms2Entities hm = new hms2Entities())
            {
                patient tblpatient = new patient();
                tblpatient.FirstName   = ad.firstName;
                tblpatient.LastName    = ad.lastName;
                tblpatient.Disease     = ad.Disease;
                tblpatient.Cellnum     = ad.cellnum;
                tblpatient.CNIC        = ad.cnic;
                tblpatient.Gender      = ad.gender;
                tblpatient.Nationality = ad.nationality;

                hm.patients.Add(tblpatient);

                hm.SaveChanges();

                adID = tblpatient.ID;
            }
            return(adID);
        }
Ejemplo n.º 8
0
 public bool updatedoc(Adddoctormodel std)
 {
     using (hms2Entities mm = new hms2Entities())
     {
         var data = mm.doctors.Where(x => x.ID == std.SID).FirstOrDefault();
         if (data != null)
         {
             data.FirstName       = std.firstName;
             data.LastName        = std.lastName;
             data.qualification   = std.qualification;
             data.Cellnum         = std.cellnum;
             data.CNIC            = std.cnic;
             data.Gender          = std.gender;
             data.Nationality     = std.nationality;
             mm.Entry(data).State = EntityState.Modified;
             mm.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Ejemplo n.º 9
0
 public bool updatepat(AddpatientModel std)
 {
     using (hms2Entities db = new hms2Entities())
     {
         var data = db.patients.Where(x => x.ID == std.pID).FirstOrDefault();
         if (data != null)
         {
             data.FirstName       = std.firstName;
             data.LastName        = std.lastName;
             data.Disease         = std.Disease;
             data.CNIC            = std.cnic;
             data.Cellnum         = std.cellnum;
             data.Gender          = std.gender;
             data.Nationality     = std.nationality;
             db.Entry(data).State = EntityState.Modified;
             db.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }