public ActionResult Details(Int32 id) { var model = new PublisherDetailViewModel(); model.Publisher = this.DbContext.Publishers .Where(pub => pub.Id == id) .FirstOrDefault(); model.LayoutModel = this.BaseModel; return(View(model)); }
public PublisherDetailViewModelTests() { eventAggregatorMock = new Mock <IEventAggregator>(); metroDialogServiceMock = new Mock <IMetroDialogService>(); publishersRepoMock = new Mock <IRepository <Publisher> >(); viewModel = new PublisherDetailViewModel(eventAggregatorMock.Object, metroDialogServiceMock.Object, publishersRepoMock.Object); }
public async Task <IActionResult> Details(Guid?Id) { if (Id == null) { throw new ArgumentNullException(nameof(Id)); } var publisher = await publishersRepository.GetSelectedAsync((Guid)Id); var vm = new PublisherDetailViewModel(publisher); return(View(vm)); }
public PublisherDetailViewModelTests() { var eventAggregatorMock = new Mock <IEventAggregator>(); var loggerMock = new Mock <ILogger>(); var repositoryMock = new Mock <IRepository <Publisher> >(); var publisherService = new PublisherService(repositoryMock.Object); var dialogService = new DialogService(); viewModel = new PublisherDetailViewModel(eventAggregatorMock.Object, loggerMock.Object, publisherService, dialogService); }
public IActionResult Detail(int?id) { if (id == null) { return(NotFound()); } var publisher = _dbContext.Publisher.First(p => p.Id == id); var publisherGames = _dbContext.Game.Where(g => g.PublisherId == id).ToList(); foreach (var game in publisherGames) { game.Category = _dbContext.Category.First(c => c.Id == game.CategoryId); game.Publisher = _dbContext.Publisher.First(p => p.Id == game.PublisherId); } PublisherDetailViewModel categoryViewModel = new PublisherDetailViewModel(publisher); categoryViewModel.GamesTableViewModel = new GamesTableViewModel(publisherGames, "List of games for selected publisher", false); return(View(categoryViewModel)); }