public void testGetListFilmTypesByIdFilm(int idFilm) { BllManager bllManager = new BllManager(); List <GenreDTO> genreDtos = bllManager.GetListFilmTypesByIdFilm(idFilm); Console.WriteLine("Liste des genres pour le film : " + idFilm); foreach (GenreDTO genreDto in genreDtos) { Console.WriteLine(genreDto); } Assert.Pass(); }
public IActionResult GetListGenreByIdFilm(int idFilm) { ResponseSingleObject<List<GenreDTO>> responseSingleObject = new ResponseSingleObject<List<GenreDTO>>() { Status = StatusCodes.Status500InternalServerError, Errors = null, Message = null, Succeded = false, Value = null }; try { List<GenreDTO> genres = _bllManager.GetListFilmTypesByIdFilm(idFilm); if (genres == null) { responseSingleObject.Status = StatusCodes.Status404NotFound; responseSingleObject.Errors = "nombre de genre trouvé = null"; } else { if (genres.Count == 0) { responseSingleObject.Status = StatusCodes.Status404NotFound; responseSingleObject.Errors = "nombre de genre trouvé = 0"; } else { responseSingleObject.Status = StatusCodes.Status200OK; responseSingleObject.Value = genres; } } } catch (Exception e) { responseSingleObject.Errors = "GetListGenreByIdFilm() EXCEPTION : " + e.ToString(); } return StatusCode(responseSingleObject.Status, responseSingleObject); }