public ActionResult Index() { var model = new SliderModel(); var activeSlider = _sliderService.GetDefaultSlider(); if (activeSlider != null) { model = activeSlider.ToModel(); foreach (var picture in activeSlider.Pictures.Where(x => x.IsActive == true)) { model.Pictures.Add(new PictureModel() { AlternateText = picture.AlternateText, IsActive = picture.IsActive, Id = picture.Id, PictureSrc = picture.PictureSrc, Size = picture.Size, Url = picture.Url, CaptionOff = model.ShowCaption, Width = picture.Width, Height = picture.Height }); } } return(PartialView("~/Views/Slider/Index.cshtml", model)); }