Ejemplo n.º 1
0
        public IActionResult Index()
        {
            int     Id = Autentification.GetLoggedUser(HttpContext).Id;
            Museums m  = museumRepository.GetMuseumByAccId(Id);

            IEnumerable <TicketTypes> model = tickettypeRepository.GetTicketTypes(m.Id);

            ViewData["Allow"] = m.OnlineTickets;


            return(View("Index", model));
        }
Ejemplo n.º 2
0
        public IActionResult Details(int id)
        {
            Museums  m     = museumRepository.GetMuseum(id);
            MuseumVM model = new MuseumVM();

            model.Id          = m.Id;
            model.Address     = m.Address;
            model.Description = m.Description;
            model.Email       = m.Email;
            if (model.Image != null)
            {
                model.ImageId = model.Image.Id;
            }

            model.Images        = imageRepository.GetMuseumImages(id);
            model.Latitude      = m.Latitude;
            model.Longitude     = m.Longitude;
            model.Image         = imageRepository.GetMuseumImage(m.Id);
            model.Name          = m.Name;
            model.OpeningYear   = m.OpeningYear;
            model.Phone         = m.Phone;
            model.TicketSelling = m.OnlineTickets;
            model.Type          = m.MuseumType.Name;
            model.UserId        = m.UserId;
            List <Artworks> artworks = artworkRepository.GetArtworksByMuseum(m.Id);

            model.Artworks = new List <ArtworkVM>();
            foreach (Artworks a in artworks)
            {
                ArtworkVM vm = new ArtworkVM();
                vm.Artist        = a.Artist.Name;
                vm.ArtworkType   = a.ArtworkType.Name;
                vm.ArtworkTypeId = a.ArtworkTypeId;
                vm.Country       = a.Country.Name;
                vm.Id            = a.Id;
                vm.Image         = imageRepository.GetArtworkImage(a.Id);
                if (vm.Image != null)
                {
                    vm.ImageId = vm.Image.Id;
                }
                vm.Name     = a.Name;
                vm.MuseumId = a.MuseumId;
                model.Artworks.Add(vm);
            }

            List <News> news = newsRepository.GetNews(m.Id);

            model.News = new List <NewsVM>();
            foreach (News x in news)
            {
                NewsVM n = new NewsVM();
                n.Id    = x.Id;
                n.Date  = x.Date;
                n.Image = imageRepository.GetNewsImage(x.Id);
                if (n.Image != null)
                {
                    n.ImageId = n.Image.Id;
                }
                n.Museum   = x.Museum.Name;
                n.Subtitle = x.SubTitle;
                n.Text     = x.Text;
                n.Title    = x.Title;
                model.News.Add(n);
            }
            model.Collections     = collectionRepository.GetCollections(m.Id);
            model.Events          = eventRepository.GetEvents(m.Id);
            model.TicketTypes     = tickettypeRepository.GetTicketTypes(m.Id);
            model.WorkingHours    = workinghoursRepository.GetWorkingHours(m.Id);
            model.Review          = new Reviews();
            model.Review.MuseumId = m.Id;
            return(View("Details", model));
        }