Esempio n. 1
0
 public FilmDTO GetFilmById(int idFilm)
 {
     try
     {
         return(HelperBll.convertFilm(this._filmManager.getFilmFromId(idFilm)));
     }
     catch (Exception)
     {
         return(null);
     }
 }
Esempio n. 2
0
 public CommentDTO getCommentFromId(int id)
 {
     try
     {
         return(HelperBll.convertComment(this._filmManager.getCommentFromId(id)));
     }
     catch (Exception)
     {
         return(null);
     }
 }
Esempio n. 3
0
 public void DeleteComment(CommentDTO commentDto)
 {
     try
     {
         this._filmManager.DeleteComment(HelperBll.convertComment(commentDto));
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
 }
Esempio n. 4
0
 public int InsertComment(CommentDTO commentDto)
 {
     try
     {
         return(this._filmManager.InsertComment(HelperBll.convertComment(commentDto)));
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
 }
Esempio n. 5
0
 //RETURN from < ACTORS <= to
 public IQueryable <ActorDTO> getActorsFromTo(int from, int to)
 {
     try
     {
         return(this._filmManager.getActorsFromTo(from, to).Select(actor => new ActorDTO()
         {
             Films = HelperBll.convertFilms(actor.Films),
             Id = actor.Id,
             Name = actor.Name,
             Surname = actor.Surname
         }));
     }
     catch (Exception)
     {
         return(null);
     }
 }
Esempio n. 6
0
 //RETURN from < COMMENTS <= to
 public IQueryable <CommentDTO> getCommentsFromTo(int from, int to)
 {
     try
     {
         return(this._filmManager.getCommentsFromTo(from, to).Select(comment => new CommentDTO()
         {
             Content = comment.Content,
             Date = comment.Date,
             Film = HelperBll.convertFilm(comment.Film),
             Id = comment.Id,
             Rate = comment.Rate,
             Username = comment.Username
         }));
     }
     catch (Exception)
     {
         return(null);
     }
 }
Esempio n. 7
0
 //RETURN from < FILMS <= to
 public IQueryable <FilmDTO> getFilmsFromTo(int from, int to)
 {
     try
     {
         return(this._filmManager.getFilmsFromTo(from, to).Select(film => new FilmDTO()
         {
             //Actors = HelperBll.convertActors(film.Actors),
             Comments = HelperBll.convertComments(film.Comments),
             //Genres = HelperBll.convertGenres(film.Genres),
             Id = film.Id,
             PosterPath = film.PosterPath,
             ReleaseDate = film.ReleaseDate,
             Runtime = film.Runtime,
             Title = film.Title,
             VoteAverage = film.VoteAverage
         }));
     }
     catch (Exception)
     {
         return(null);
     }
 }
Esempio n. 8
0
 // FindListFilmByPartialActorName(…) : récupère la liste des films (List<FilmDTO>)
 // dans lequel l’acteur dont on donne un nom partiellement ou entièrement
 public IQueryable <FilmDTO> FindListFilmByPartialActorName(int from, int to, string nomActeur)
 {
     try
     {
         return(this._filmManager.FindListFilmByPartialActorName(from, to, nomActeur).Select(film => new FilmDTO()
         {
             //Actors = HelperBll.convertActors(film.Actors),
             Comments = HelperBll.convertComments(film.Comments),
             //Genres = HelperBll.convertGenres(film.Genres),
             Id = film.Id,
             PosterPath = film.PosterPath,
             ReleaseDate = film.ReleaseDate,
             Runtime = film.Runtime,
             Title = film.Title,
             VoteAverage = film.VoteAverage
         }));
     }
     catch (Exception)
     {
         return(null);
     }
 }
Esempio n. 9
0
        // GetListFilmTypesByIdFilm(...) : récupère la liste des genres d’un film
        public List <GenreDTO> GetListFilmTypesByIdFilm(int idFilm)
        {
            try
            {
                Film film = this._filmManager.getFilmFromId(idFilm);
                if (film == null)
                {
                    return(new List <GenreDTO>());
                }

                List <GenreDTO> genreDtos = new List <GenreDTO>();
                foreach (Genre filmGenre in film.Genres)
                {
                    genreDtos.Add(HelperBll.convertGenre(filmGenre));
                }

                return(genreDtos);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Esempio n. 10
0
        //public IQueryable<Film> getFilmsFromToWhere(int from, int to, Func<Film, bool> whereCondition)
        //{
        //    return this._filmContext.Films.Where(whereCondition).Skip(from).Take((to-from));
        //    //retourner des films paginés
        //}

        // GetListActorsByIdFilm(...) : récupère la liste des acteurs d’un film
        public List <LightActorDTO> GetListActorsByIdFilm(int from, int to, int idFilm)
        {
            try
            {
                Film film = this._filmManager.getFilmFromId(idFilm);
                if (film == null)
                {
                    return(new List <LightActorDTO>());
                }

                List <LightActorDTO> lightActorDtos = new List <LightActorDTO>();
                List <Actor>         filmActors     = film.Actors.Skip(from).Take((to - from)).ToList();
                foreach (Actor filmActor in filmActors)
                {
                    lightActorDtos.Add(HelperBll.ConvertLightActorDto(filmActor));
                }

                return(lightActorDtos);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Esempio n. 11
0
 public ActorDTO getActorFromId(int id)
 {
     return(HelperBll.convertActor(this._filmManager.getActorFromId(id)));
 }