示例#1
0
        public ActionResult MuseumDetailPage(int?museumId)
        {
            if (museumId != null)
            {
                Museum museum = dbMuseum.GetMuseum(museumId);


                return(View(museum));
            }

            return(RedirectToAction("MuseumOverview"));
        }
        public IActionResult Details(int id)
        {
            Artworks a = artworkRepository.GetArtworkById(id);
            Museums  m = museumRepository.GetMuseum(a.MuseumId);

            ArtworkVM model = new ArtworkVM();

            model.AccessionNumber = a.AccessionNumber;
            model.Active          = a.Active;
            model.ArtistId        = a.ArtistId;
            model.ArtworkTypeId   = a.ArtworkTypeId;
            model.CatalogueEntry  = a.CatalogueEntry;
            model.CountryId       = a.CountryId;
            model.Date            = a.Date;
            model.Id            = a.Id;
            model.MaterialId    = a.MaterialId;
            model.MuseumId      = a.MuseumId;
            model.Name          = a.Name;
            model.Provenance    = a.Provenance;
            model.StyleId       = a.StyleId;
            model.Artist_S      = a.Artist.Name;
            model.ArtworkType_S = a.ArtworkType.Name;
            model.Country_S     = a.Country.Name;
            model.Material_S    = a.Material.Name;
            model.Style_S       = a.Style.Name;
            model.Images        = imageRepository.GetArtworkImages(a.Id);

            model.Artist      = new SelectList(artistRepository.GetArtists(), "Id", "Name");
            model.ArtworkType = new SelectList(artworkTypeRepository.GetArtworkTypes(), "Id", "Name");
            model.Country     = new SelectList(countryRepository.GetCountries(), "Id", "Name");
            model.Material    = new SelectList(materialRepository.GetMaterials(), "Id", "Name");
            model.Style       = new SelectList(styleRepository.GetStyles(), "Id", "Name");

            ViewData["download"] = m.QrScanning;
            return(View("Details", model));
        }
示例#3
0
        public IActionResult Details(int id)
        {
            Museums model = museumRepository.GetMuseum(id);

            return(View("Details", model));
        }
示例#4
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));
        }