예제 #1
0
        /// <summary>
        /// Displays the homepage. Homepage contains two sections to display top game and top category.
        /// </summary>
        /// <returns>Returns a result based on status</returns>
        public ActionResult Index()
        {
            ActionResult response;
            ReviewVM     viewModel = new ReviewVM();

            try
            {
                //instantiate lists
                viewModel.ReviewsList = new List <ReviewPO>();
                List <ReviewDO> reviewDOs = new List <ReviewDO>();

                //call DAO to get list of reviews
                reviewDOs = _ReviewDataAccess.ViewReviews();

                //call BLL for most recommended category
                viewModel.Review = _ReviewMapper.MapDOtoPO(_ReviewDataAccess.TopCategory());

                //call DAO and BLL for most recommended game
                int topGameID = _BusinessLogic.TopGame(reviewDOs);
                viewModel.Game = _GameMapper.MapDOtoPO(_GameDataAccess.ViewGameByID(topGameID));

                response = View(viewModel);
            }
            catch (Exception ex)
            {
                //log error
                _Logger.ErrorLog(MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, ex);
                response = RedirectToAction("Error", "Home");
            }
            finally { }

            return(response);
        }