public ActionResult Edit(int id) { if (!ModelState.IsValid) { return(HttpNotFound()); } var dbGallery = _galleryRepo.GetGalleryById(id); if (dbGallery == null) { return(HttpNotFound()); } GetSignedUser(); if (!_signedUser.CanManageAllContent() && !dbGallery.Account.Equals(_signedUser)) { return(RedirectToAction("Index", "Home")); } var viewModel = new GalleryViewModel { Gallery = dbGallery, ContentCategories = _categoryRepo.GetActiveContentCategories(), ContentSubCategories = _categoryRepo.GetContentSubcategoriesByParentId(dbGallery.ContentCategory.Id) }; viewModel.Gallery.Pictures = _galleryRepo.GetGalleryPictures(id); return(View(viewModel)); }
public ActionResult Edit(int id) { var dbEntry = _entryRepo.GetEntry(id); if (dbEntry == null) { return(HttpNotFound()); } GetSignedUser(); if (!_signedUser.CanManageAllContent() && !dbEntry.Account.Equals(_signedUser)) { return(RedirectToAction("Index", "Home")); } var viewModel = new EntryViewModel { Entry = dbEntry, ContentCategories = _contentCategoryRepo.GetActiveContentCategories(), ContentSubCategories = _contentCategoryRepo.GetContentSubcategoriesByParentId(dbEntry.ContentCategory.Id) }; return(View(viewModel)); }