public IActionResult Add(HttpResponse response, HttpSession session)
 {
     if (!AuthenticatedManager.IsAdmin(session.Id))
     {
         this.Redirect(response, "/user/login");
     }
     return(this.View());
 }
        public void Delete(HttpResponse response, HttpSession session, DeleteViewModel bind)
        {
            if (!AuthenticatedManager.IsAdmin(session.Id))
            {
                this.Redirect(response, "/user/login");
            }

            this.service.Delete(bind.Id);
            this.Redirect(response, "/game/managing");
        }
        public void Edit(HttpResponse response, HttpSession session, EditGameBindingModel bind)
        {
            if (!AuthenticatedManager.IsAdmin(session.Id))
            {
                this.Redirect(response, "/user/login");
            }

            this.service.EditGame(bind);
            this.Redirect(response, "/game/managing");
        }
        public IActionResult <EditViewModel> Edit(HttpResponse response, HttpSession session, int id)
        {
            if (!AuthenticatedManager.IsAdmin(session.Id))
            {
                this.Redirect(response, "/user/login");
            }

            EditViewModel model = this.service.GetEditViewModel(id);

            return(this.View(model));
        }
        public IActionResult <AllAdminGameViewModel> Managing(HttpSession session, HttpResponse response)
        {
            if (!AuthenticatedManager.IsAuthenticated(session.Id))
            {
                this.Redirect(response, "/user/login");
                return(null);
            }
            if (!AuthenticatedManager.IsAdmin(session.Id))
            {
                this.Redirect(response, "/home/games");
                return(null);
            }
            var model = this.service.GetAllAdminViewModel();

            return(this.View(model));
        }
        public IActionResult Add(HttpResponse response, HttpSession session, AddGameBindingModel bind)
        {
            if (!AuthenticatedManager.IsAdmin(session.Id))
            {
                this.Redirect(response, "/user/login");
            }
            //validations for adding a game
            if (!this.service.IsAddGameViewModelValid(bind))
            {
                this.Redirect(response, "/game/add");
                return(null);
            }
            //add game to database
            Game game = this.service.GetGameFromAddGameBind(bind);

            this.service.AddGame(game);
            this.Redirect(response, "/game/managing");
            return(this.View());
        }