コード例 #1
0
        public IActionResult <DetailsGameVm> Details(HttpSession session, HttpResponse response, int id)
        {
            if (!AuthenticationManager.IsUserAuthenticated(session.Id))
            {
                this.Redirect(response, "/users/login");
                return(null);
            }

            User currentUser = AuthenticationManager.GetAuthenticatedUser(session.Id);

            DetailsGameVm vm = this.service.GetDetailedGameVm(id);

            return(this.View(vm));
        }
コード例 #2
0
        public DetailsVm GetDetails(int id)
        {
            DetailsVm model = new DetailsVm();

            Game game = this.data.Games.FindByPredicate(x => x.Id == id);

            var details = new List <DetailsGameVm>();

            DetailsGameVm newGameVm = new DetailsGameVm()
            {
                Description = game.Description,
                Price       = game.Price,
                ReleaseDate = game.ReleaseDate,
                Size        = game.Size,
                Title       = game.Title,
                YouTubeId   = game.YouTubeId
            };

            details.Add(newGameVm);
            model.DetailsGameVms = details;

            return(model);
        }