public void SaveReview(Review1 review) { if (review.ReviewId == 0) { context.Reviews.Add(review); } else { Review1 reviewEntry = context.Reviews .FirstOrDefault(r => r.ReviewId == review.ReviewId); if (reviewEntry != null) { reviewEntry.ReviewBody = review.ReviewBody; reviewEntry.Rating = review.Rating; //Add RecipeId reviewEntry.RecipeId = review.RecipeId; } } context.SaveChanges(); }
public static void AddReviews(Review1 review) { reviews.Add(review); }