public ActionResult OwnerArtCollection(OwnerIndexViewModel ownerIndexViewModel) { var artWork = (from ip in db.IndividualPiece join aw in db.ArtWork on ip.ArtWorkId equals aw.ArtWorkId join ar in db.Artist on aw.ArtistId equals ar.ArtistId where ip.Sold == false where ip.Location.Replace(" ", "") == ownerIndexViewModel.Location.Replace(" ", "") select new ArtViewModel { ArtWorkId = ip.ArtWorkId, Title = aw.Title, Category = ip.Category, Name = ar.Name, Image = ip.Image, Medium = ip.Medium, Price = ip.Price, Cost = ip.Cost, Edition = ip.EditionNumber, IndividualPieceId = ip.IndividualPieceId, Location = ownerIndexViewModel.Location }).ToList(); ArtListViewModel artListViewModel = new ArtListViewModel { artViewModel = artWork, Location = ownerIndexViewModel.Location }; return(View(artListViewModel)); }
public ActionResult Home(int?id) { if (id == null) { string userId = User.Identity.GetUserId(); id = db.Owners.Where(o => o.UserId == userId).FirstOrDefault().Id; if (id == null) { return(View("NotFound")); } } List <FuneralHome> homes = db.FuneralHomes.Where(h => h.Owner.Id == id).ToList(); List <OwnerIndexViewModel> indexs = new List <OwnerIndexViewModel>(); List <Service> services = new List <Service>(); foreach (var home in homes) { int PDFCount = home.Services.Where(h => h.PDF != null).Count(); int VidCount = home.Services.Where(h => h.Video != null).Count(); OwnerIndexViewModel index = new OwnerIndexViewModel { TotalServices = home.Services.Count(), MonthlyServices = home.Services.Where(s => s.ServiceDate > DateTime.Now.AddDays(-30)).Count(), HomeName = home.Name, City = home.City, State = home.State, PDFViews = 0, VideoViews = 0, HasPaid = home.PaymentStatus, Id = home.Id, PageViews = 0, NumberOfPdfs = PDFCount, NumberOfVideos = VidCount }; var pdfViews = 0; var pageViews = 0; var videoViews = 0; foreach (var service in home.Services) { if (service.PDF != null) { pdfViews = pdfViews + service.PDF.PageHits; } if (service.Video != null) { videoViews = videoViews + service.Video.PageHits; } pageViews = pageViews + service.PageHits; services.Add(service); } //Page Views is very innacurate do to only being calculated on sites with video embedded index.PageViews = pageViews; index.PDFViews = pdfViews; index.VideoViews = videoViews; indexs.Add(index); } setViewBagAnalytics(services); return(View(indexs)); }
public IActionResult Owners() { var model = new OwnerIndexViewModel { Owners = _modelFetcher.GetAllOwnerViewModels() }; return(View(model)); }
// GET: Owner View public ActionResult Index() { var locations = (from ip in db.IndividualPiece select ip.Location).ToList().Distinct(); List <OwnerIndexViewModel> LocationImages = new List <OwnerIndexViewModel>(); foreach (var item in locations) { OwnerIndexViewModel vw = new OwnerIndexViewModel { Image = (from ip in db.IndividualPiece where ip.Location == item select ip.Image).FirstOrDefault(), Location = item.Replace(" ", "") }; LocationImages.Add(vw); } return(View(LocationImages)); }