Example #1
0
 public void AddHospitalDetail(HospitalDetails hospitalDetails)
 {
     using (MyWebApplicationContext db = new MyWebApplicationContext())
     {
         db.HospitalDetails.Add(hospitalDetails);
         db.SaveChanges();
     }
 }
Example #2
0
 public void AddReviewEntry(ReviewEntry reviewEntry)
 {
     using (MyWebApplicationContext db = new MyWebApplicationContext())
     {
         db.ReviewEntries.Add(reviewEntry);
         db.SaveChanges();
     }
 }
Example #3
0
        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);
            }
        }
Example #4
0
        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;
                    }
                }
            }
        }