Exemplo n.º 1
0
        public IActionResult <GenericVm> All(HttpSession session, HttpResponse response)
        {
            if (!manager.IsAuthenticated(session))
            {
                Redirect(response, "/users/login");
                return(null);
            }

            User getUser = manager.GetAuthenticatedUser(session);

            if (!getUser.IsAdmin)
            {
                Redirect(response, "/home/index");
                return(null);
            }

            GenericVm model = this.service.GenericPage();

            return(this.View(model));
        }
Exemplo n.º 2
0
        public GenericVm GenericPage()
        {
            GenericVm      model = new GenericVm();
            GenericAdminVm admin = new GenericAdminVm();
            var            game  = this.data.Games.GetAll();

            var list = new List <GenericAdminVm>();

            foreach (var onegame in game)
            {
                admin = new GenericAdminVm()
                {
                    Name  = onegame.Title,
                    Price = onegame.Price,
                    Size  = onegame.Size
                };
                list.Add(admin);
            }
            model.Generic = list;

            return(model);
        }