public async Task <IActionResult> Details(int?id) { if (id == null) { return(NotFound()); } var studio = id.HasValue ? await _studioService.GetStudio(id.Value) : null; if (studio == null) { return(NotFound()); } return(View(studio)); }
public async Task GetGenreTest() { int studioId = 1; var studio = new Studio() { StudioId = studioId, Name = "Studio One" }; var fakeRepositoryMock = new Mock <IStudioRepository>(); fakeRepositoryMock.Setup(x => x.GetStudio(studioId)).ReturnsAsync(studio); var studioService = new StudioService(fakeRepositoryMock.Object); var resultStudio = await studioService.GetStudio(studioId); Assert.Equal("Studio One", resultStudio.Name); }
public async Task <Studio> Get(int id) { return(await studioService.GetStudio(id)); }