public IHttpResponse Details(IHttpRequest request)
        {
            IHttpSession session = request.Session;

            if (session.Containts(SessionKeys.CurrentUser))
            {
                this.ShowUserNavBar(session.GetParameter(SessionKeys.CurrentUser).ToString());
            }
            else
            {
                this.ShowGuestNavBar();
            }

            int gameId = int.Parse(request.UrlParameters["id"]);

            GameDetailsViewModel model = this.GameService.Details(gameId);

            this.ViewData["gameId"]          = gameId.ToString();
            this.ViewData["gameTitle"]       = model.Title;
            this.ViewData["gameTrailer"]     = model.Trailer;
            this.ViewData["gameDescription"] = model.Description;
            this.ViewData["gamePrice"]       = model.Price.ToString("F2");
            this.ViewData["gameSize"]        = model.Size.ToString("F1");
            this.ViewData["gameReleaseDate"] = model.ReleaseDate.ToString("dd/MM/yyyy");

            return(this.FileViewResponse(@"game\details"));
        }
        public IActionResult Details(int id)
        {
            if (!this.gameService.IsGameExisting(id))
            {
                return(this.RedirectToHome());
            }

            GameDetailsViewModel model = this.gameService.GetGameDetailsById(id);

            if (model == null)
            {
                return(this.RedirectToHome());
            }

            string adminDisplay = this.IsAdmin == true ? "inline-block" : "none";

            this.ViewModel["adminDisplay"] = adminDisplay;
            this.ViewModel["id"]           = model.Id.ToString();
            this.ViewModel["title"]        = model.Title;
            this.ViewModel["description"]  = model.Description;
            this.ViewModel["price"]        = model.Price.ToString("F2");
            this.ViewModel["size"]         = model.Size.ToString("F2");
            this.ViewModel["videoId"]      = model.VideoId;
            this.ViewModel["releaseDate"]  = model.ReleaseDate.ToString("yyyy-MM-dd");

            return(this.View());
        }
Exemplo n.º 3
0
        public GameDetailsViewModel GetGameDetails(int id, HttpSession session)
        {
            Game game = this.Context.Games.Find(id);
            GameDetailsViewModel gameDetailsViewModel = Mapper.Map <GameDetailsViewModel>(game);

            return(gameDetailsViewModel);
        }
Exemplo n.º 4
0
        public ActionResult UserReview(int id, int reviewid)
        {
            Review review = _reviewService.Find(reviewid);
            var    game   = _gameService.FindActive(id);

            if (game == null || review == null)
            {
                return(NotFound());
            }

            var DetailsModel = new GameDetailsViewModel
            {
                ReviewPlaytimes = _reviewService.PrepareReviews(new List <Review> {
                    review
                }, null, null),
                RelevantArticles = _articleService.GetAll().Where(a => a.GameId == id).OrderByDescending(a => a.PublishedDate).Take(3),
                GameInfo         = SetupGameInfo(game)
            };

            DetailsModel.ReviewPlaytimes.Pagination.Action = this.ControllerContext.ActionDescriptor.ActionName.ToString();

            var userid = _userService.GetLoggedInUserId();

            if (review.UserId == userid)
            {
                ViewBag.CanEdit = true;
            }
            else
            {
                ViewBag.CanEdit = false;
            }
            return(View(DetailsModel));
        }
Exemplo n.º 5
0
        public ActionResult Details(int id)
        {
            var game = _context.Games.Single(c => c.Id == id);

            if (game == null)
            {
                return(HttpNotFound());
            }
            else
            {
                var           categories       = _context.Ref_Category.ToList();
                List <string> categoryNameList = new List <string>();
                foreach (Ref_Category ct in categories)
                {
                    if (game.GetAllAssignedTicketsCategorized(ct.Id).Count > 0)
                    {
                        categoryNameList.Add(ct.Name);
                    }
                }

                var vm = new GameDetailsViewModel
                {
                    Id          = game.Id,
                    Fixture     = game.getFixture(),
                    Competition = game.GetCompetition().Name,
                    Date        = game.Date,
                    Tickets     = game.GetAllAssignedTickets(),
                    Categories  = categoryNameList
                };
                return(View(vm));
            }
        }
Exemplo n.º 6
0
        public IActionResult App(string appid)
        {
            if (string.IsNullOrWhiteSpace(appid))
            {
                return(Index());
            }

            //var app = database.GetCollection<GameInfo>("Games").FindSync($"{{AppId = {appid}}}").FirstOrDefault();

            var     gameInfo = Get($"https://store.steampowered.com/api/appdetails?appids={appid}&cc=ru&l=ru");
            JObject jgames   = JsonConvert.DeserializeObject <JObject>(gameInfo);

            if (jgames[appid]["success"].Value <bool>() == false)
            {
                return(Error("О такой игре у нас нет информации, но вы держитесь и всего хорошего."));
            }
            JObject data  = jgames[appid]["data"] as JObject;
            var     model = new GameDetailsViewModel()
            {
                AppId       = appid,
                Description = data["detailed_description"].ToString(),
                Name        = data["name"].ToString(),
                Price       = data["price_overview"]["final"].Value <int>()
            };

            JArray screenshots            = data["screenshots"] as JArray;
            List <ScreenshotInfo> screens = new List <ScreenshotInfo>();

            foreach (var scr in screenshots)
            {
                screens.Add(scr.ToObject <ScreenshotInfo>());
            }
            model.Screens = screens;
            return(View(model));
        }
        public async Task <IActionResult> GameDetails(int id)
        {
            var result = await gamesSearchService.SearchByIdAsync(id);

            var similarGames = await gamesSearchService.SearchSimilarGamesAsync(id);

            var storesList = await gamesSearchService.SearchStoresListAsync(id);

            var gameReview = await reviewService.GetReviewsAsync(id);

            var postRelatedToGame = await postService.GetAllPosts();

            Review review      = new Review();
            var    reviewCount = gameReview.Count();
            var    model       = new GameDetailsViewModel
            {
                Game         = result,
                SimilarGames = similarGames.results,
                StoresList   = storesList.results,
                Reviews      = gameReview,
                Review       = review,
                ReviewCount  = reviewCount,
            };

            //var allStoresList = await gamesSearchService.SearchAllStoresListAsync();
            //ViewBag.SimilarGames = similarGames.results;
            //ViewBag.Stores = storesList.results;
            //ViewBag.AllStoresList = allStoresList.results;
            return(View(model));
        }
Exemplo n.º 8
0
        //todo buy
        public void BuyGame(GameDetailsViewModel model, User user)
        {
            Game game = this.Context.Games.FirstOrDefault(g => g.Id == model.Id);

            user.Games.Add(game);
            this.Context.SaveChanges();
        }
Exemplo n.º 9
0
        internal static GameDetailsViewModel ToDetailsViewModel(Game game)
        {
            var vm = new GameDetailsViewModel
            {
                ID             = game.ID,
                Title          = game.Title,
                AlternateTitle = game.AlternateTitle,
                Platform       = game.Platform.Name,
                ReleaseDate    = game.ReleaseDate.ToString(EntityConstants.DateFormatString),
                Genres         = game.FullGenres,
                Modes          = game.FullModes,
                Series         = game.FullSeries,
                Developers     = game.FullDevelopers,
                Publishers     = game.FullPublishers,
                MediaType      = game.MediaType.Name,
                Language       = game.Language.Name,
                Description    = game.Description
            };

            if (game.PlayData != null && game.PlayData.Count > 0)
            {
                foreach (var pd in game.PlayData)
                {
                    var pdVM = PlayDataMapper.ToGameDetailsViewModel(pd);

                    vm.PlayData.Add(pdVM);
                }
            }

            return(vm);
        }
Exemplo n.º 10
0
        public IActionResult Details(int id)
        {
            if (id == 0)
            {
                return(NotFound());
            }

            Game game = gameService.GetByID(id);

            if (game == null)
            {
                return(NotFound());
            }

            GameDetailsViewModel viewModel = new GameDetailsViewModel
            {
                Game         = game,
                Genre        = genreService.GetByID(game.GenreID),
                Developer    = developerService.GetByID(game.DeveloperID),
                Publisher    = publisherService.GetByID(game.PublisherID),
                Platform     = platformService.GetByID(game.PlatformID),
                Review       = reviewService.GetByID(game.Reviews.Select(x => x.GameID = game.ID).FirstOrDefault()),
                SignedInUser = userManager.GetUserAsync(HttpContext.User).Result ?? null
            };

            return(View(viewModel));
        }
Exemplo n.º 11
0
        public async Task <ActionResult> GetGameByKey(string key)
        {
            GameDetailsViewModel game = null;

            try
            {
                var gameBll = await _gameService.GetDetailsByKeyAsync(key);

                game = _mapperWeb.Map <GameDetailsViewModel>(gameBll);
            }
            catch (ValidationException ex)
            {
                return(View("Error", new HandleErrorInfo(ex, "Game", "Index")));
            }
            catch (AccessException ex)
            {
                return(View("Error", new HandleErrorInfo(ex, "Game", "Index")));
            }
            catch (Exception)
            {
                return(View("Error", new HandleErrorInfo(new InvalidOperationException("Bad request"), "Game", "Index")));
            }

            return(View(game));
        }
Exemplo n.º 12
0
        public ActionResult GameDetails(int?boardgameID)
        {
            if (boardgameID == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            BoardgameModel boardgame = repo.GetBoardgameByID(boardgameID);

            if (boardgame == null)
            {
                return(HttpNotFound());
            }

            BoardgameDisplayModel newDisplay = new BoardgameDisplayModel
            {
                BoardgameID = boardgame.ID,
                DisplayDate = DateTime.Now,
                Source      = DisplaySource.WWW
            };

            repo.AddNewDisplay(newDisplay);

            List <BoardgameDisplayModel> gameDisplaysList = repo.GetLast10GameDisplays(boardgame.ID);

            var model = new GameDetailsViewModel
            {
                Boardgame        = boardgame,
                GameDisplaysList = gameDisplaysList
            };

            return(View(model));
        }
Exemplo n.º 13
0
        public async Task <IActionResult> AddComment(GameDetailsViewModel model)
        {
            var userId = this.userManager.GetUserId(this.User);

            await this.gameService.AddRating(userId, model.Id, model.AddUserRatingScore, model.AddUserRatingContent);

            return(this.RedirectToAction("Details", new { id = model.Id }));
        }
Exemplo n.º 14
0
        public GameDetailsViewModel GetGameDetailsViewModel(int gameId, int gamerId)
        {
            var viewModel = new GameDetailsViewModel();

            viewModel.Details = GetGameDetails(gameId);

            return(viewModel);
        }
Exemplo n.º 15
0
        public GameDetailsViewModel GetDetails(string id)
        {
            var game = this.gamesRepository.All().FirstOrDefault(x => x.Id == id);

            if (game == null)
            {
                throw new ArgumentException(GameDoNotExist);
            }

            var levels = levelsRepository.All().Where(x => x.GameId == id).OrderBy(x => x.NumberInGame).ToList();

            var levelss = levels.Select(x => mapper.Map <LevelViewModel>(x))
                          .OrderBy(x => x.NumberInGame).ToList();

            var gameParticipantsLevel1 = this.levelsParticipantRepository.All()
                                         .Where(l => l.GameId == id && l.LevelId == levels[0].Id && l.StatusLevel == StatusLevel.NotPassed)
                                         .Select(x => mapper.Map <GameLevelParticipantViewModel>(x)).ToList();

            gameParticipantsLevel1.ForEach(x => x.Participant = this.usersRepository
                                                                .All().FirstOrDefault(u => u.Id == x.ParticipantId).FirstName +
                                                                SpaceSeparetedUsersFirstAndLastName + this.usersRepository
                                                                .All().FirstOrDefault(u => u.Id == x.ParticipantId).LastName);

            var gameParticipantsLevel2 = this.levelsParticipantRepository.All()
                                         .Where(l => l.GameId == id && l.LevelId == levels[1].Id && l.StatusLevel == StatusLevel.NotPassed)
                                         .Select(x => mapper.Map <GameLevelParticipantViewModel>(x)).ToList();

            gameParticipantsLevel2.ForEach(x => x.Participant = this.usersRepository
                                                                .All().FirstOrDefault(u => u.Id == x.ParticipantId).FirstName +
                                                                SpaceSeparetedUsersFirstAndLastName + this.usersRepository
                                                                .All().FirstOrDefault(u => u.Id == x.ParticipantId).LastName);

            var gameParticipantsLevel3 = this.levelsParticipantRepository.All()
                                         .Where(l => l.GameId == id && l.LevelId == levels[2].Id && l.StatusLevel == StatusLevel.NotPassed)
                                         .Select(x => mapper.Map <GameLevelParticipantViewModel>(x)).ToList();

            gameParticipantsLevel3.ForEach(x => x.Participant = this.usersRepository
                                                                .All().FirstOrDefault(u => u.Id == x.ParticipantId).FirstName +
                                                                SpaceSeparetedUsersFirstAndLastName + this.usersRepository
                                                                .All().FirstOrDefault(u => u.Id == x.ParticipantId).LastName);

            var gameModel = new GameDetailsViewModel
            {
                Id                     = game.Id,
                Name                   = game.Name,
                Description            = game.Description,
                Creator                = this.usersRepository.All().FirstOrDefault(x => x.Id == game.CreatorId).FirstName,
                Level1                 = levelss[0],
                Level2                 = levelss[1],
                Level3                 = levelss[2],
                GameParticipantsLevel1 = gameParticipantsLevel1,
                GameParticipantsLevel2 = gameParticipantsLevel2,
                GameParticipantsLevel3 = gameParticipantsLevel3
            };

            return(gameModel);
        }
Exemplo n.º 16
0
        public IActionResult DeleteGame(int id)
        {
            GameDetailsViewModel game = this.gameService.GetGame(id);

            if (game == null)
            {
                return(RedirectToAction(RedirectConstants.IndexSuffix));
            }

            return(this.View(game));
        }
Exemplo n.º 17
0
        public void Info(HttpSession session, HttpResponse response, GameDetailsViewModel model)
        {
            User user = AuthenticatedManager.GetAuthenticatedUser(session.Id);

            if (user == null)
            {
                this.Redirect(response, "/home/games");
                return;;
            }
            this.service.GetGameFromViewModel(model);
        }
Exemplo n.º 18
0
        public IActionResult <GameDetailsViewModel> Info(HttpSession session, HttpResponse response, int id)
        {
            if (!AuthenticatedManager.IsAuthenticated(session.Id))
            {
                this.Redirect(response, "/user/login");
                return(null);
            }
            GameDetailsViewModel model = this.service.GetGameDetailsViewModel(id);

            return(this.View(model));
        }
Exemplo n.º 19
0
        public GameDetailsViewModel GetGameDetails(string id, string userId)
        {
            Game game = this.GetGame(id);

            GameDetailsViewModel gameDetails = Mapper.Map<Game, GameDetailsViewModel>(game);
            gameDetails.IsJoined = game.Players.Select(p => p.UserId).Contains(userId);
            gameDetails.IsAdmin = game.Group.Admins.Select(a => a.Id).Contains(userId);

            gameDetails.Players = gameDetails.Players.OrderBy(p => p.CreatedOn).ToList();

            return gameDetails;
        }
Exemplo n.º 20
0
        public IActionResult <GameDetailsViewModel> Details(HttpResponse response, HttpSession session, int gameId)
        {
            if (!this.signInManager.IsAuthenticated(session))
            {
                Redirect(response, "/users/login");
                return(null);
            }

            GameDetailsViewModel gameDetails = this.service.GetGameDetails(gameId);

            return(this.View(gameDetails));
        }
Exemplo n.º 21
0
        public IActionResult <GameDetailsViewModel> Details(int gameId, HttpSession session, HttpResponse response)
        {
            if (!this.loginManager.IsAuthenticated(session))
            {
                this.Redirect(response, "/home/login");
                return(null);
            }

            GameDetailsViewModel viewModel = this.gameService.ShowDetails(gameId);

            return(this.View(viewModel));
        }
Exemplo n.º 22
0
        public IActionResult <GameDetailsViewModel> Details(int id, HttpSession session, HttpResponse response)
        {
            User activeUser = AuthenticationManager.GetAuthenticatedUser(session.Id);

            if (activeUser == null)
            {
                this.Redirect(response, "/users/login");
                return(null);
            }
            GameDetailsViewModel detailsGame = this.service.GetDetailsFromGame(id);

            return(this.View(detailsGame));
        }
Exemplo n.º 23
0
        public ActionResult MyGameDetails(int id)
        {
            string error = "";

            GameDetailsViewModel gameDetails = _bgcServices.GetGameDetails(id, out error);

            if (string.IsNullOrWhiteSpace(error))
            {
                return(View(gameDetails));
            }

            return(View("Error", error));
        }
Exemplo n.º 24
0
        public MainWindow(GameDetailsViewModel gameDetailsVm, Container container, MainViewModel mainVm)
        {
            _container = container;
            InitializeComponent();
            gameDetailsVm.GameData = "TestData";
            DataContext            = mainVm;

            gameDetailsVm.LoadProjectCommand.BoardWindow = this;

            Closing += MainWindow_Closing;

            CardController.InitializeControl(_container);
        }
Exemplo n.º 25
0
        public IActionResult Detail(int id)
        {
            if (id == 0)
            {
                return(NotFound());
            }
            var model = new GameDetailsViewModel()
            {
                Game = GameModel.GenerateGameModelFromDTO(work.GameRepository.GetGameDetails(id))
            };

            return(View(model));
        }
Exemplo n.º 26
0
        public ActionResult Details(Int32 id)
        {
            var model = new GameDetailsViewModel();

            model.Game = DbContext.Games
                         .Include("Publisher")
                         .Include("Categories")
                         .Include("Comments.User.Avatar")
                         .Where(g => g.Id == id)
                         .FirstOrDefault();
            model.LayoutModel = this.BaseModel;
            return(View(model));
        }
Exemplo n.º 27
0
        public IActionResult CreateTeam(GameDetailsViewModel postedModel)
        {
            var game = _dbContext.Games.Include(g => g.Teams).Single(g => g.GameID == postedModel.GameId);

            var team = game.AddTeam(postedModel.TeamToAdd);

            var player = team.AddPlayer(UserId, User.GetUsername());

            _dbContext.SaveChanges();

            Response.SetGameCookie(UserId, postedModel.GameId, player.PlayerID, player.Name, team.TeamID);

            return(RedirectToAction("Play", "Game"));
        }
Exemplo n.º 28
0
        public GameDetailsViewModel GetGameDetails(int gameId, out string error)
        {
            var game      = GetGame(gameId, out error);
            var viewModel = new GameDetailsViewModel()
            {
                Name               = game.Name,
                Published          = game.Published,
                BoardGamePictureId = game.PictureId
            };

            viewModel.Owners = GetGameOwnerCount(gameId, out error);

            return(viewModel);
        }
Exemplo n.º 29
0
        public IActionResult Details(int gameId)
        {
            Game game = context.Games.Single(g => g.Id == gameId);
            IList <GenreGameId>      genreGameIds      = null;
            IList <ReleaseGameId>    releaseGameIds    = null;
            IList <ScreenshotGameId> screenshotGameIds = null;

            if (game.CoverId != 0)
            {
                game.Cover = context.Covers.Find(game.CoverId);
            }

            if (context.GenreGameIds.Any(g => g.GameId == game.Id))
            {
                genreGameIds = context
                               .GenreGameIds
                               .Include(ggid => ggid.Genre)
                               .Where(ggid => ggid.GameId == game.Id)
                               .ToList();
            }

            if (context.ReleaseGameIds.Any(r => r.GameId == game.Id))
            {
                releaseGameIds = context
                                 .ReleaseGameIds
                                 .Include(rgid => rgid.ReleaseDate)
                                 .Where(rgid => rgid.GameId == game.Id)
                                 .ToList();
            }

            if (context.ScreenshotGameIds.Any(s => s.GameId == game.Id))
            {
                screenshotGameIds = context
                                    .ScreenshotGameIds
                                    .Include(sgid => sgid.Screenshot)
                                    .Where(sgid => sgid.GameId == game.Id)
                                    .ToList();
            }

            GameDetailsViewModel viewModel = new GameDetailsViewModel
            {
                Game         = game,
                Genres       = genreGameIds,
                ReleaseDates = releaseGameIds,
                Screenshots  = screenshotGameIds
            };

            return(View(viewModel));
        }
Exemplo n.º 30
0
        internal GameDetailsViewModel ShowDetails(int gameId)
        {
            Game game = this.context.Games.Find(gameId);
            GameDetailsViewModel viewModel = new GameDetailsViewModel()
            {
                GameId      = game.Id,
                Title       = game.Title,
                Description = game.Description,
                Price       = game.Price,
                Trailer     = game.Trailer,
                Size        = game.Size,
                ReleaseDate = game.ReleaseDate
            };

            return(viewModel);
        }