コード例 #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)));
        }
コード例 #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));
        }
コード例 #3
0
ファイル: GameController.cs プロジェクト: Worble/DndHelper
        public IActionResult Delete(GameDeleteViewModel model)
        {
            work.GameRepository.Delete(model.Game.ID);
            work.Save();

            return(RedirectToAction("Index"));
        }
コード例 #4
0
ファイル: GameController.cs プロジェクト: Worble/DndHelper
        public IActionResult Delete(int id)
        {
            var model = new GameDeleteViewModel()
            {
                Game = GameModel.GenerateGameModelFromDTO(work.GameRepository.GetGameDetails(id))
            };

            return(View(model));
        }
コード例 #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"));
        }
コード例 #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));
        }