Ejemplo n.º 1
0
        public async Task <IActionResult> Delete(GameDeleteViewModel input)
        {
            await this.gamesService.DeleteAsync(input.Id);

            this.TempData["InfoMessage"] = "Game deleted successfully!";
            return(this.RedirectToAction(nameof(this.Index)));
        }
Ejemplo n.º 2
0
        public IActionResult Delete(int id)
        {
            if (id == 0)
            {
                return(NotFound());
            }

            Game game = gameService.GetByID(id);

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

            GameDeleteViewModel viewModel = new GameDeleteViewModel
            {
                Game      = gameService.GetByID(id),
                Genre     = genreService.GetByID(game.GenreID),
                Developer = developerService.GetByID(game.DeveloperID),
                Publisher = publisherService.GetByID(game.PublisherID),
                Platform  = platformService.GetByID(game.PlatformID),
                Reviews   = reviewService.GetAll()
            };

            return(View(viewModel));
        }
Ejemplo n.º 3
0
        public IActionResult Delete(GameDeleteViewModel model)
        {
            work.GameRepository.Delete(model.Game.ID);
            work.Save();

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 4
0
        public IActionResult Delete(int id)
        {
            var model = new GameDeleteViewModel()
            {
                Game = GameModel.GenerateGameModelFromDTO(work.GameRepository.GetGameDetails(id))
            };

            return(View(model));
        }
Ejemplo n.º 5
0
        public IActionResult Delete(GameDeleteViewModel viewModel)
        {
            Game game = gameService.GetByID(viewModel.Game.ID);

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

            gameService.Delete(game.ID);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 6
0
        public ViewResult Delete(int id)
        {
            var game = gameRepository.GetById(id);

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

            GameDeleteViewModel model = new GameDeleteViewModel
            {
                Id            = game.Id,
                Name          = game.Name,
                Description   = game.Description,
                Genres        = game.Genres,
                RelaseDate    = game.RelaseDate,
                ExistingPhoto = game.PhotoUrl,
                Rating        = game.Rating
            };

            return(View(model));
        }