Exemple #1
0
        public bool Update(Review review)
        {
            bool    result    = false;
            MovieDA movieTask = new MovieDA();

            try
            {
                bool IsMovie = movieTask.Get(review.movieId) != null ? true : false;
                movieTask.UpdateSeen(review.movieId);
                if (IsMovie)
                {
                    XElement reviewX       = xmlReviewdoc.Descendants("Review").FirstOrDefault(c => c.Element("id").Value == Convert.ToString(review.id));
                    XElement updatedReview = FillXElementFromEntity(reviewX, review);
                    //xmlReviewdoc.Root.Add(updatedReview);
                    xmlReviewdoc.Save(xmlReviewPath);
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            catch (Exception)
            {
            }
            return(result);
        }
Exemple #2
0
        public bool Insert(Review review)
        {
            bool    result    = false;
            MovieDA movieTask = new MovieDA();

            try
            {
                bool IsMovie = movieTask.Get(review.movieId) != null ? true : false;
                movieTask.UpdateSeen(review.movieId);
                if (IsMovie)
                {
                    XElement reviewX = new XElement("Review",
                                                    new XElement("id", review.id),
                                                    new XElement("movieId", review.movieId),
                                                    new XElement("text", review.text),
                                                    new XElement("rating", review.rating)
                                                    );
                    xmlReviewdoc.Root.Add(reviewX);
                    xmlReviewdoc.Save(xmlReviewPath);
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            catch (Exception)
            {
            }

            return(result);
        }