Example #1
0
        public async Task <List <GameReview> > GetReviewsByID(int GameID)
        {
            SqlParameter gameParam = new SqlParameter {
                ParameterName = "@GameID", SqlDbType = SqlDbType.Int, Value = GameID
            };

            return(await GetReviews.FromSql("Exec CoQ.GetReviewsByID @GameID", gameParam)
                   .AsNoTracking()
                   .ToListAsync());
        }
Example #2
0
        public ActionResult SetMovieObject(string id)
        {
            var        movie  = movieManager.GetMovieDetailsByIMDBID(id);
            GetReviews review = new GetReviews()
            {
                MovieTitle = movie.Title,
                IMDBID     = movie.IMDBID
            };

            ModelState.Clear();
            return(View("WriteReview", review));
        }
Example #3
0
        public ActionResult WriteReview(GetReviews model)
        {
            GetReviews review = new GetReviews();

            if (model.Review != null)
            {
                movieManager.SaveReview(model);
                review = model;
            }

            return(View(review));
        }
Example #4
0
        public ReviewsViewModel GetMovieReviewList()
        {
            var lmr = db.movie_Review.OrderBy(r => r.MovieTitle).ToList();
            List <GetReviews> reviews = new List <GetReviews>();
            var list = AutoMapper.Mapper.Map(lmr, reviews);

            foreach (movie_Review mr in lmr)
            {
                GetReviews r = new GetReviews()
                {
                    id_Review       = mr.id_Review,
                    Reviewer        = GetReviewer(mr.id_Reviewer).FirstName,
                    UserReviewCount = GetReviewer(mr.id_Reviewer).Reviews.ToString(),
                    IMDBID          = mr.IMDB_ID,
                    MovieTitle      = mr.MovieTitle,
                    ReviewTitle     = mr.ReviewTitle,
                    Review          = mr.Review,
                    OverAllPoints   = mr.OverAllPoints,
                    ScriptPoints    = mr.ScriptPoints,
                    SoundPoints     = mr.SoundPoints,
                    EffectsPoints   = mr.EffectsPoints,
                    ActingPoints    = mr.ActingPoints,
                    TotalPoints     = mr.TotalScore
                };
                // short date
                DateTime d = mr.ReviewDate.Value;
                r.ReviewDate = d.ToShortDateString();

                reviews.Add(r);
            }

            ReviewsViewModel MovieReviews = new ReviewsViewModel();

            MovieReviews.Reviews = reviews;

            return(MovieReviews);
        }
Example #5
0
        public GetReviews SaveReview(GetReviews review)
        {
            // Get total points avg score
            int sum = review.ActingPoints + review.EffectsPoints + review.SoundPoints + review.ScriptPoints +
                      review.OverAllPoints;
            Double avg = sum / 5;
            Double tp  = Math.Round(avg, 0);

            review.TotalPoints = int.Parse(tp.ToString());
            review.id_Reviewer = GetReviewerByUName(review.Reviewer);

            //  Parse out year from movie title
            var s = review.MovieTitle.Split('(');

            review.MovieTitle = s[0];

            movie_Review movieReview = new movie_Review()
            {
                IMDB_ID       = review.IMDBID,
                MovieTitle    = review.MovieTitle,
                ReviewTitle   = review.ReviewTitle,
                id_Reviewer   = review.id_Reviewer,
                ActingPoints  = review.ActingPoints,
                OverAllPoints = review.OverAllPoints,
                TotalScore    = review.TotalPoints,
                SoundPoints   = review.SoundPoints,
                ScriptPoints  = review.ScriptPoints,
                EffectsPoints = review.EffectsPoints,
                ReviewDate    = DateTime.Now.Date,
                Review        = review.Review
            };

            db.movie_Review.AddOrUpdate(movieReview);
            db.SaveChanges();
            return(review);
        }
        public IActionResult GetSpecialistReviews([FromQuery] GetReviews query, long id)
        {
            var specialist = SpecialistService.Get(id);

            if (specialist == null)
            {
                return(NotFound(new ResponseModel
                {
                    Success = false,
                    Message = "Специалист не найден"
                }));
            }

            var reviews = ReviewService.GetSpecialistReviews(specialist, query.Type);

            return(Ok(new ListResponse <ReviewViewModel>
            {
                Data = reviews.Skip((query.PageNumber - 1) * query.PageSize).Take(query.PageSize).ToList(),
                PageSize = query.PageSize,
                CurrentPage = query.PageNumber,
                TotalPages = (int)Math.Ceiling(reviews.Count / (double)query.PageSize),
                TotalItems = reviews.Count
            }));
        }
Example #7
0
 public async Task <ActionResult <UseCaseResult <ReviewModel> > > Get([FromQuery] GetReviews request)
 {
     return(Ok(await UseCase.Execute(request)));
 }
Example #8
0
        private async void GetReviewContext()
        {
            var validGetReviews = await GetReviews.SendGetReviews();

            await GetOrdersRequest.SendGetOrdersRequest();

            if (validGetReviews)
            {
                var reviewList = RealmManager.All <ReviewList>().FirstOrDefault().reviews;
                ReviewStatList = new ReviewStatList(reviewList);

                uxOverallReviewList.ItemsSource   = ReviewStatList.OverallReviewStats;
                uxWaitstaffReviewList.ItemsSource = ReviewStatList.WaitstaffReviewStats;
                uxFoodReviewList.ItemsSource      = ReviewStatList.FoodReviewStats;

                uxScore1ReviewNumber.Text = "Dijkstra's Average Rating: " + ReviewStatList.Average1.ToString() + " Stars";

                if (ReviewStatList.Average1 <= 1)
                {
                    uxScore1Star1.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore1Star2.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                    uxScore1Star3.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                    uxScore1Star4.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                    uxScore1Star5.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                }
                if (ReviewStatList.Average1 > 1 && ReviewStatList.Average1 <= 2)
                {
                    uxScore1Star1.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore1Star2.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore1Star3.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                    uxScore1Star4.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                    uxScore1Star5.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                }
                if (ReviewStatList.Average1 > 2 && ReviewStatList.Average1 <= 3)
                {
                    uxScore1Star1.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore1Star2.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore1Star3.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore1Star4.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                    uxScore1Star5.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                }
                if (ReviewStatList.Average1 > 3 && ReviewStatList.Average1 <= 4)
                {
                    uxScore1Star1.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore1Star2.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore1Star3.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore1Star4.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore1Star5.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                }
                if (ReviewStatList.Average1 > 4 && ReviewStatList.Average1 <= 5)
                {
                    uxScore1Star1.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore1Star2.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore1Star3.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore1Star4.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore1Star5.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                }

                uxScore2ReviewNumber.Text = "Dijkstra's Average Rating: " + ReviewStatList.Average2.ToString() + " Stars";

                if (ReviewStatList.Average2 <= 1)
                {
                    uxScore2Star1.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore2Star2.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                    uxScore2Star3.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                    uxScore2Star4.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                    uxScore2Star5.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                }
                if (ReviewStatList.Average2 > 1 && ReviewStatList.Average2 <= 2)
                {
                    uxScore2Star1.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore2Star2.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore2Star3.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                    uxScore2Star4.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                    uxScore2Star5.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                }
                if (ReviewStatList.Average2 > 2 && ReviewStatList.Average2 <= 3)
                {
                    uxScore2Star1.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore2Star2.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore2Star3.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore2Star4.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                    uxScore2Star5.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                }
                if (ReviewStatList.Average2 > 3 && ReviewStatList.Average2 <= 4)
                {
                    uxScore2Star1.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore2Star2.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore2Star3.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore2Star4.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore2Star5.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                }
                if (ReviewStatList.Average2 > 4 && ReviewStatList.Average2 <= 5)
                {
                    uxScore2Star1.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore2Star2.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore2Star3.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore2Star4.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore2Star5.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                }

                uxScore3ReviewNumber.Text = "Dijkstra's Average Rating: " + ReviewStatList.Average3.ToString() + " Stars";

                if (ReviewStatList.Average3 <= 1)
                {
                    uxScore3Star1.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore3Star2.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                    uxScore3Star3.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                    uxScore3Star4.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                    uxScore3Star5.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                }
                if (ReviewStatList.Average3 > 1 && ReviewStatList.Average3 <= 2)
                {
                    uxScore3Star1.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore3Star2.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore3Star3.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                    uxScore3Star4.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                    uxScore3Star5.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                }
                if (ReviewStatList.Average3 > 2 && ReviewStatList.Average3 <= 3)
                {
                    uxScore3Star1.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore3Star2.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore3Star3.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore3Star4.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                    uxScore3Star5.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                }
                if (ReviewStatList.Average3 > 3 && ReviewStatList.Average3 <= 4)
                {
                    uxScore3Star1.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore3Star2.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore3Star3.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore3Star4.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore3Star5.Source = new BitmapImage(new Uri("ms-appx:///Assets/greyStar.png"));
                }
                if (ReviewStatList.Average3 > 4 && ReviewStatList.Average3 <= 5)
                {
                    uxScore3Star1.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore3Star2.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore3Star3.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore3Star4.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                    uxScore3Star5.Source = new BitmapImage(new Uri("ms-appx:///Assets/goldStar.png"));
                }
            }
        }