public IActionResult GetName() { UserAccounts model = Autentification.GetLoggedUser(HttpContext); Museums m = museumRepository.GetMuseumByAccId(model.Id); return(PartialView("GetName", m.Name)); }
public IActionResult Index() { int id = Autentification.GetLoggedUser(HttpContext).Id; Museums m = museumRepository.GetMuseumByAccId(id); List <Artworks> model = artworkRepository.GetArtworksByMuseum(m.Id); List <ArtworkInfoVM> list = new List <ArtworkInfoVM>(); foreach (Artworks x in model) { ArtworkInfoVM vm = new ArtworkInfoVM(); vm.Id = x.Id; vm.Artist = x.Artist.Name; vm.ArtistId = x.ArtistId; vm.Likes = likesRepository.GetLikes(x.Id); vm.Name = x.Name; vm.Image = imageRepository.GetArtworkImage(x.Id); if (vm.Image != null) { vm.ImageId = vm.Image.Id; } list.Add(vm); } ViewData["collections"] = collectionRepository.GetCollections(m.Id); return(View("Index", list)); }
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)); }
public IActionResult Add() { int id = Autentification.GetLoggedUser(HttpContext).Id; Museums m = museumRepository.GetMuseumByAccId(id); Events model = new Events(); model.MuseumId = m.Id; model.StartDate = DateTime.Now; model.EndTime = DateTime.Now; return(View("Add", model)); }
public IActionResult Index() { int id = Autentification.GetLoggedUser(HttpContext).Id; Museums m = museumRepository.GetMuseumByAccId(id); List <Collections> model = collectionRepository.GetCollections(m.Id); foreach (Collections x in model) { if (x.Description.Length > 200) { x.Description = x.Description.Substring(0, 200); } } return(View("Index", model)); }
public IActionResult Index() { int id = Autentification.GetLoggedUser(HttpContext).Id; Museums m = museumRepository.GetMuseumByAccId(id); List <News> news = newsRepository.GetNews(m.Id); List <NewsVM> model = new List <NewsVM>(); foreach (News x in news) { NewsVM vm = new NewsVM(); vm.Id = x.Id; vm.Date = x.Date; vm.MuseumId = x.MuseumId; vm.Subtitle = x.SubTitle; if (x.Text.Length > 200) { vm.Text = x.Text.Substring(0, 200); } else { vm.Text = x.Text; } vm.Title = x.Title; vm.Images = imageRepository.GetNewsImage(x.Id); if (vm.Images != null) { vm.ImageId = vm.Images.Id; } vm.Img = null; model.Add(vm); } return(View("Index", model)); }
public IActionResult Index() { UserAccounts u = Autentification.GetLoggedUser(HttpContext); Administrators admin = null; Museums museum = null; if (u != null) { if (adminRepository.GetAdministrator(u.Id) != null) { admin = adminRepository.GetAdministrator(u.Id); } if (museumRepository.GetMuseumByAccId(u.Id) != null) { museum = museumRepository.GetMuseumByAccId(u.Id); } } if (admin != null) { return(RedirectToAction("Index", "Home", new { area = "Administrator" })); } else if (museum != null) { return(RedirectToAction("Index", "Home", new { area = "Moderator" })); } else { HomeVM model = new HomeVM(); List <Museums> list = museumRepository.GetTop3(); model.Museums = new List <MuseumVM>(); model.Artworks = new List <ArtworkVM>(); model.News = new List <NewsVM>(); List <Artworks> artworks = artworkRepository.GetTop6(); List <News> news = newsRepository.GetLatest(); foreach (Museums x in list) { MuseumVM m = new MuseumVM(); m.Id = x.Id; m.Description = x.Description; m.Image = imageRepository.GetMuseumImage(x.Id); m.Name = x.Name; if (m.Image != null) { m.ImageId = m.Image.Id; } model.Museums.Add(m); } foreach (Artworks x in artworks) { ArtworkVM a = new ArtworkVM(); a.Id = x.Id; a.Name = x.Name; a.Artist = x.Artist.Name; a.Museum = x.Museum.Name; a.Image = imageRepository.GetArtworkImage(x.Id); if (a.Image != null) { a.ImageId = a.Image.Id; } model.Artworks.Add(a); } 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); } return(View("Index", model)); } }