Beispiel #1
0
        public static List <Amenity> GetByCinemaId(Guid cinemaId)
        {
            var cinemaAmenities = CinemaAmenities.GetByCinemaId(cinemaId);

            var amenities = cinemaAmenities.Select(p => p.Amenity.Value).ToList();

            return(amenities);
        }
Beispiel #2
0
        public static List <Cinema> GetAll()
        {
            try
            {
                string data = Path.Cinema;

                if (!File.Exists(Path.Cinema))
                {
                    return(new List <Cinema>());
                }

                DataSet ds = new DataSet();
                ds.ReadXml(data);
                var cinemas = new List <Cinema>();
                cinemas = (from rows in ds.Tables[0].AsEnumerable()
                           select new Cinema
                {
                    Id = Guid.Parse(rows[0].ToString()),
                    Name = rows[1].ToString(),
                    Latitude = Convert.ToDecimal(rows[2].ToString()),
                    Longitude = Convert.ToDecimal(rows[3].ToString()),
                    Address = rows[4].ToString(),

                    CinemaAmenities = new Lazy <List <CinemaAmenity> >(() =>
                    {
                        return(CinemaAmenities.GetByCinemaId(Guid.Parse(rows[0].ToString())));
                    })
                }).ToList();

                if (cinemas == null)
                {
                    return(new List <Cinema>());
                }

                return(cinemas);
            }
            catch
            {
                return(new List <Cinema>());
            }
        }