public MovieFull getMovieFull(int?id) { var movie = dc.Movies.Include("Genres").Include("Director").SingleOrDefault(n => n.Id == id); if (movie == null) { return(null); } MovieFull mf = new MovieFull(); mf.MovieId = movie.Id; mf.Title = movie.Title; mf.TicketPrice = movie.TicketPrice; mf.Director = rd.toDirectorFull(movie.Director); mf.Genres = rg.toListOfGenreBase(movie.Genres); return(mf); }
public IEnumerable <MovieFull> getListOfMovieFull() { var movies = dc.Movies.Include("Genres").OrderBy(m => m.Title); List <MovieFull> mfls = new List <MovieFull>(); foreach (var item in movies) { MovieFull mf = new MovieFull(); mf.MovieId = item.Id; mf.Title = item.Title; mf.TicketPrice = item.TicketPrice; mf.Director = rd.getDirectorFull(item.Id); mf.Genres = rg.toListOfGenreBase(item.Genres); mfls.Add(mf); } return(mfls); }
public DirectorFull toDirectorFull(Models.Director d) { if (d == null) { return(null); } DirectorFull df = new DirectorFull(); df.DirectorId = d.Id; df.Name = d.Name; df.Movies = new List <MovieFull>(); foreach (var item in d.Movies) { MovieFull m = new MovieFull(); m.MovieId = item.Id; m.TicketPrice = item.TicketPrice; m.Title = item.Title; df.Movies.Add(m); } return(df); }