public void AddHospitalDetail(HospitalDetails hospitalDetails) { using (MyWebApplicationContext db = new MyWebApplicationContext()) { db.HospitalDetails.Add(hospitalDetails); db.SaveChanges(); } }
public void AddReviewEntry(ReviewEntry reviewEntry) { using (MyWebApplicationContext db = new MyWebApplicationContext()) { db.ReviewEntries.Add(reviewEntry); db.SaveChanges(); } }
public bool DeleteHospitalDetail(int id) { using (MyWebApplicationContext db = new MyWebApplicationContext()) { HospitalDetails hospitalDetails = db.HospitalDetails.Find(id); if (hospitalDetails == null) { return(false); } db.HospitalDetails.Remove(hospitalDetails); db.SaveChanges(); return(true); } }
public bool ModifyHospitalDetail(int id, HospitalDetails hospitalDetails) { using (MyWebApplicationContext db = new MyWebApplicationContext()) { db.Entry(hospitalDetails).State = EntityState.Modified; try { db.SaveChanges(); return(true); } catch (DbUpdateConcurrencyException) { if (!HospitalDetailsExists(id)) { return(false); } else { throw; } } } }