public ActionResult GalleryDetail(int solutionId = 0, string redirectUrl = "") { var category = _solutionService.Find(solutionId); if (category == null) return RedirectToAction("Index"); var gallery = _galleryService.GetGalleryByObject(solutionId, (int)GalleryCategory.Solution, (int)GalleryType.ImageAndVideo); if (gallery == null) { gallery = new Gallery() { ObjectId = solutionId, Category = (int)GalleryCategory.Solution, CreatedDate = DateTime.Now, Name = category.Name, Type = (int)GalleryType.ImageAndVideo, Alias = category.Alias }; _galleryService.Insert(gallery); _unitOfWork.SaveChanges(); } return RedirectToAction("Index", "Gallery", new { galleryId = gallery != null ? gallery.Id : 0, redirectUrl = redirectUrl }); }
public ActionResult GalleryDetail(int productId = 0, string redirectUrl = "") { var product = _productService.Find(productId); if (product == null) return RedirectToAction("Index"); var gallery = _galleryService.GetGalleryByObject(productId, (int)GalleryCategory.Product, (int)GalleryType.ImageAndVideo); if (gallery == null) { gallery = new Gallery() { ObjectId = productId, Category = (int)GalleryCategory.Product, CreatedDate = DateTime.Now, Name = product.Name, Alias = product.Alias, Type = (int)GalleryType.ImageAndVideo }; _galleryService.Insert(gallery); _unitOfWork.SaveChanges(); } return RedirectToAction("Index", "Gallery", new { galleryId = gallery != null ? gallery.Id : 0, redirectUrl = redirectUrl }); }