Ejemplo n.º 1
0
        public ReviewerModelDTO AddReviewer(ReviewerModelDTO newReviewer)
        {
            ReviewerModelDTO ret = null;

            using (var db = new RestaurantReviewsContext())
            {
                TblReviewer reviewer = ModelFactory.Create(newReviewer);
                db.TblReviewer.Add(reviewer);
                db.SaveChanges();
                ret = ModelFactory.Create(reviewer);
            }

            return(ret);
        }
Ejemplo n.º 2
0
        public ReviewModelDTO DeleteReview(int id)
        {
            ReviewModelDTO ret = null;

            using (var db = new RestaurantReviewsContext())
            {
                TblReview review = db.TblReview.Find(id);
                if (review != null)
                {
                    db.TblReview.Remove(review);
                    db.SaveChanges();
                    ret = ModelFactory.Create(review);
                }
            }

            return(ret);
        }