public ActionResult EditImage(int id) { var gallery = _galleryService.GetGalleryImageById(id); if (gallery == null) { //No gallery found with the specified id return(RedirectToAction("ImagesList")); } var galleries = _galleryService.GetAllGalleries(); var model = gallery.ToModel(); model.ListGalleries.Add(new SelectListItem { Text = "Remove from all galleries", Value = "-1" }); foreach (var g in galleries) { if (gallery.Galleries.Contains(g)) { model.ListGalleries.Add(new SelectListItem { Text = g.Name, Value = g.Id.ToString(CultureInfo.InvariantCulture), Selected = true }); } else { model.ListGalleries.Add(new SelectListItem { Text = g.Name, Value = g.Id.ToString(CultureInfo.InvariantCulture), Selected = false }); } } //locales AddLocales(_languageService, model.Locales, (locale, languageId) => { locale.Name = gallery.GetLocalized(x => x.Name, languageId, false, false); locale.Description = gallery.GetLocalized(x => x.Description, languageId, false, false); }); return(View("~/Plugins/Widgets.Gallery/Views/GalleryConfigure/EditImage.cshtml", model)); }
public ActionResult SingleImage(int id, int?galleryId) { var image = _galleryService.GetGalleryImageById(id); var alt = image.GetLocalized(x => x.Description) != null ? image.GetLocalized(x => x.Description).Replace("<p>", "").Replace("</p>", "") : ""; var model = new PictureModel { FullSizeImageUrl = _pictureService.GetPictureUrl(image.PictureId), ImageUrl = _pictureService.GetPictureUrl(image.PictureId, GalleryThumbPictureSize), Title = image.GetLocalized(x => x.Name), AlternateText = alt, }; ViewBag.ShowGalleries = _gallerySettings.ShowGalleries; ViewBag.Id = galleryId; return(View("~/Plugins/Widgets.Gallery/Views/GalleryPublicInfo/SingleImage.cshtml", model)); }