public ActionResult GetMeta(LandingPageItemViewModel model) { MetaModel meta = new MetaModel { DESC = model.Description, KEYWORD = model.Keywords, TITLE = model.Title }; if (meta == null) { meta = new MetaModel(); } return(PartialView("~/Views/Shared/_Meta.cshtml", meta)); }
//PictureItemNoBufferData public static List<LandingPageItemViewModel> GetImagesForLandingPage() { using (var db = (ArtGalleryDBContext)DependencyResolver.Current.GetService<DbContext>()) { var pictureDal = new PictureDal(db); var landingPageDal = new LandingPageDal(db); var fullList = landingPageDal.Enitities.ToList(); var list = fullList.Select(x => x.PictureId).ToList(); var selected = from p in pictureDal.Enitities from l in list where p.ID == l select new PictureItemNoBufferData() { Artist = p.Artist, Created = p.Created, ID = p.ID, Media = p.Media, Price = p.Price, Size = p.Size, Theme = p.Theme, Title = p.Title, UserId = p.UserId, DisplayOrder = p.DisplayOrder }; var ret = selected.ToList(); List<LandingPageItemViewModel> list2 = new List<LandingPageItemViewModel>(); foreach (var landingPageItem in fullList) { var pictureItemNoBufferData = ret.FirstOrDefault(x => x.ID == landingPageItem.PictureId); if (pictureItemNoBufferData == null) { //LogOnModel logOnModel = Permissions.GetCurrentUser(); //if(logOnModel!=null) { pictureItemNoBufferData = new PictureItemNoBufferData() { UserId = 1 }; } } if (pictureItemNoBufferData != null) { var landingPageItemViewModel = new LandingPageItemViewModel() { LandingPageItemId = landingPageItem.Id, Picture = pictureItemNoBufferData }; list2.Add(landingPageItemViewModel); } } return list2; } }