public static List <Location> FindAll() { // recebe o conteúdo da tabela var locationListTb = db.LOCATIONTB; List <Location> locationList = new List <Location>(); if (locationListTb != null) { //converte para model foreach (var location in locationListTb) { locationList.Add(new Location { Id = location.IDLOCATION, CPF = location.CPF, CreationDate = (DateTime)location.CREATIONDATE, MovieList = MovieDAO.FindAll() } ); } } return(locationList); }
public static Location FindById(int Id) { var locationTb = db.LOCATIONTB.Find(Id); var location = new Location { Id = locationTb.IDLOCATION, CPF = locationTb.CPF, CreationDate = (DateTime)locationTb.CREATIONDATE }; location.MovieList = MovieDAO.FindAll(); return(location); }