Exemple #1
0
        public RoomDTO(Room room)
        {
            if (room == null)
            {
                return;
            }

            List <ScreenTypeDTO> list = new List <ScreenTypeDTO>();

            this.Id               = room.Id;
            this.Name             = room.Name;
            this.TotalRows        = room.TotalRows;
            this.TotalSeatsPerRow = room.TotalSeatsPerRow;
            this.TotalSeats       = this.TotalSeatsPerRow * this.TotalRows;
            if (room.RoomScreenTypes != null)
            {
                foreach (var roomScreenType in room.RoomScreenTypes)
                {
                    var screenType = new ScreenTypeDTO()
                    {
                        Id   = roomScreenType.ScreenType.Id,
                        Name = roomScreenType.ScreenType.Name,
                    };
                    list.Add(screenType);
                }
            }
            this.ScreenTypes = list;
        }
Exemple #2
0
        public MovieDTO(Movie movie)
        {
            if (movie == null)
            {
                return;
            }

            this.Id         = movie.Id;
            this.Country    = movie.Country;
            this.Title      = movie.Title;
            this.Runtime    = movie.Runtime;
            this.Poster     = movie.Poster;
            this.Trailer    = movie.Trailer;
            this.Wallpapers = movie.Wallpapers;
            this.ReleasedAt = movie.ReleasedAt;
            this.Languages  = movie.Languages;
            this.Story      = movie.Story;
            this.EndAt      = movie.EndAt;
            this.Directors  = movie.Directors;
            this.Imdb       = movie.Imdb;
            List <ScreenTypeDTO> list = new List <ScreenTypeDTO>();

            if (movie.MovieScreenTypes != null)
            {
                foreach (var movieScreenType in movie.MovieScreenTypes)
                {
                    var screenTypeDTO = new ScreenTypeDTO()
                    {
                        Id   = movieScreenType.ScreenType.Id,
                        Name = movieScreenType.ScreenType.Name,
                    };
                    list.Add(screenTypeDTO);
                }
            }
            this.ScreenTypes = list;

            List <ActorDTO> actors = new List <ActorDTO>();

            if (movie.MovieActors != null)
            {
                foreach (var movieActors in movie.MovieActors)
                {
                    var actor = new ActorDTO()
                    {
                        Id     = movieActors.Actor.Id,
                        Name   = movieActors.Actor.Name,
                        Avatar = movieActors.Actor.Avatar,
                    };
                    actors.Add(actor);
                }
            }
            this.Actors = actors;
        }
Exemple #3
0
        public ShowtimeDTO(Showtime showtime)
        {
            if (showtime == null)
            {
                return;
            }

            this.Id         = showtime.Id;
            this.Status     = showtime.Status;
            this.StartAt    = showtime.StartAt;
            this.BasePrice  = showtime.BasePrice;
            this.EndAt      = showtime.EndAt;
            this.Movie      = new MovieDTO(showtime.Movie);
            this.Room       = new RoomDTO(showtime.Room);
            this.ScreenType = new ScreenTypeDTO(showtime.ScreenType);
        }