public void Create(review toInsert)
 {
     if (toInsert == null)
     {
         throw new ArgumentNullException("toInsert");
     }
     db.reviews.Add(toInsert);
     db.SaveChanges();
 }
 public void Delete(review toDelete)
 {
     if (toDelete == null)
     {
         throw new ArgumentNullException("toDelete");
     }
     db.reviews.Remove(toDelete);
     db.SaveChanges();
 }
        public review GetReviewById(int id)
        {
            review toFind = null;

            foreach (review currentRev in db.reviews)
            {
                if (currentRev.id == id)
                {
                    toFind = currentRev;
                }
            }
            return(toFind);
        }
        public void Update(review updateFrom)
        {
            if (updateFrom == null)
            {
                throw new ArgumentNullException("updateFrom");
            }
            review toUpdate = GetReviewById(updateFrom.id);

            toUpdate.reviewerName = updateFrom.reviewerName;
            toUpdate.comment      = updateFrom.comment;
            toUpdate.date         = updateFrom.date;
            toUpdate.rating       = updateFrom.rating;

            db.SaveChanges();
        }