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))); }
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)); }
public IActionResult Delete(GameDeleteViewModel model) { work.GameRepository.Delete(model.Game.ID); work.Save(); return(RedirectToAction("Index")); }
public IActionResult Delete(int id) { var model = new GameDeleteViewModel() { Game = GameModel.GenerateGameModelFromDTO(work.GameRepository.GetGameDetails(id)) }; return(View(model)); }
public IActionResult Delete(GameDeleteViewModel viewModel) { Game game = gameService.GetByID(viewModel.Game.ID); if (game == null) { return(NotFound()); } gameService.Delete(game.ID); return(RedirectToAction("Index")); }
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)); }