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); } } }
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); } } }
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); }
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); }
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); } } }
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); } } }