コード例 #1
0
        public ActionResult Index()
        {
            var venues = _venueManagementService.ListVenues();

            var venuesListViewModel = new VenuesListViewModel
            {
                Venues = MapperManager.Map <List <VenueViewModel> >(venues),
            };

            return(View(venuesListViewModel));
        }
コード例 #2
0
        private List <VenueModel> GetVenueModels()
        {
            var venueDtos   = _venueService.ListVenues();
            var venueModels = new List <VenueModel>();

            foreach (var venueDto in venueDtos)
            {
                var layoutDtos   = _venueService.GetVenueLayouts(venueDto.Id).Layouts;
                var layoutModels = new List <LayoutModel>();

                foreach (var layoutDto in layoutDtos)
                {
                    var areaDtos   = _layoutService.GetLayoutAreas(layoutDto.Id).Areas;
                    var areaModels = new List <AreaModel>();

                    foreach (var areaDto in areaDtos)
                    {
                        var seatDtos   = _areaService.GetAreaSeats(areaDto.Id).Seats;
                        var seatModels = new List <SeatModel>();

                        foreach (var seatDto in seatDtos)
                        {
                            var seatModel = new SeatModel
                            {
                                Id     = seatDto.Id,
                                AreaId = seatDto.AreaId,
                                Number = seatDto.Number,
                                Row    = seatDto.Row,
                            };

                            seatModels.Add(seatModel);
                        }

                        var areaModel = new AreaModel
                        {
                            Id          = areaDto.Id,
                            Description = areaDto.Description,
                            CoordX      = areaDto.CoordX,
                            CoordY      = areaDto.CoordY,
                            LayoutId    = areaDto.LayoutId,
                            Seats       = seatModels,
                        };

                        areaModels.Add(areaModel);
                    }

                    var layoutModel = new LayoutModel
                    {
                        Id          = layoutDto.Id,
                        VenueId     = layoutDto.VenueId,
                        Description = layoutDto.Description,
                        Areas       = areaModels,
                    };

                    layoutModels.Add(layoutModel);
                }

                var venueModel = new VenueModel
                {
                    Id          = venueDto.Id,
                    Description = venueDto.Description,
                    Address     = venueDto.Address,
                    Phone       = venueDto.Phone,
                    Layouts     = layoutModels,
                };

                venueModels.Add(venueModel);
            }

            return(venueModels);
        }