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