public IActionResult getGenresFromTo(int from, int to) { ResponsePagine<List<GenreDTO>> responsePagine = new ResponsePagine<List<GenreDTO>>() { Status = StatusCodes.Status500InternalServerError, Errors = null, Message = null, Succeded = false, Value = null, FirstPage = null, From = from, To = to, LastPage = null, TotalRecord = -1, }; try { IQueryable<GenreDTO> queryActors = _bllManager.getGenresFromTo(from, to); if (queryActors == null) { responsePagine.Status = StatusCodes.Status404NotFound; responsePagine.Errors = "getGenresFromTo(from=" + from + ", to=" + to + ") RETURN null"; } else { int nbrGenre = _bllManager.getGenresFromTo(); if (nbrGenre != -1) { if (queryActors.ToList().Count > 0) { responsePagine.Status = StatusCodes.Status200OK; responsePagine.Succeded = true; responsePagine.Value = queryActors.ToList(); responsePagine.FirstPage = ApiRoute.Actors.ActorBase + "/from=0/to=" + ((to - @from).ToString()); responsePagine.LastPage = ApiRoute.Actors.ActorBase + "/from=" + (nbrGenre - (to - @from)).ToString() + "/to=" + nbrGenre; responsePagine.TotalRecord = nbrGenre; } else { responsePagine.Status = StatusCodes.Status404NotFound; responsePagine.Errors = "nombre de genre trouvé = 0"; } } else { responsePagine.Status = StatusCodes.Status404NotFound; responsePagine.Errors = "nombre de genre trouvé = -1"; } } } catch (Exception e) { responsePagine.Errors = "getGenresFromTo(from=" + from + ", to=" + to + ") EXCEPTION : " + e.ToString(); } return StatusCode(responsePagine.Status, responsePagine); }
public void testGetGenresFromTo(int from, int to) { BllManager bllManager = new BllManager(); List <GenreDTO> genres = bllManager.getGenresFromTo(from, to).ToList(); Console.WriteLine("Genres de " + from + " a " + to + " :"); int i = 1; foreach (GenreDTO genre in genres) { Console.WriteLine("Genres [" + i + "]" + " : " + genre /*.ToStringWithFilms()*/); i++; } Console.WriteLine("Genres de : " + "Genres de " + from + " a " + to); Assert.Pass(); }
public void testGetNumberGenresFromTo() { BllManager bllManager = new BllManager(); Console.WriteLine("nombre de genres dans la bd = " + bllManager.getGenresFromTo()); }