public virtual ActionResult Delete(int id) { var photo = _context.FindById <PhotoModel>(id); if (photo == null) { return(HttpNotFound()); } var userPhotoActions = _context.FindUserPhotoActionsByPhotoId(photo.PhotoId); var comments = _context.FindCommentsByPhotoId(photo.PhotoId); foreach (var userPhotoAction in userPhotoActions) { _context.Delete(userPhotoAction); _context.SaveChanges(); } foreach (var comment in comments) { _context.Delete(comment); _context.SaveChanges(); } _context.Delete(photo); _context.SaveChanges(); return(RedirectToAction(T4Routes.Photo.Manage())); }
public ActionResult DeleteConfirmed(int id) { Comment comment = context.FindCommentById(id); context.Delete<Comment>(comment); context.SaveChanges(); return RedirectToAction("Display", "Photo", new { id = comment.PhotoID }); }
public ActionResult DeleteConfirmed(int id) { Models.Photo photo = context.FindPhotoById(id); context.Delete <Photo>(photo); context.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { Photo photo = context.FindPhotoById(id); context.Delete <Photo>(photo); context.SaveChanges(); return(View("Index")); }
public ActionResult DeleteConfirmed(int id) { Photo verif = context.FindPhotoById(id); context.Delete <Photo>(verif); context.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult ConfirmDelete(int id) { Photo photoToDelete = context.FindPhotoById(id); context.Delete(photoToDelete); context.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { Photo photo = db.FindPhotoById(id); db.Delete <Photo>(photo); db.SaveChanges(); return(RedirectToAction("Index")); }
public virtual ActionResult Delete(int id) { var comment = _context.FindById <CommentModel>(id); if (comment == null) { return(HttpNotFound()); } _context.Delete(comment); _context.SaveChanges(); return(RedirectToAction(T4Routes.Comment.Manage())); }
public virtual ActionResult Delete(int id) { var category = _context.FindById <CategoryModel>(id); if (category == null) { return(HttpNotFound()); } var photos = _context.FindPhotosByCategorySlug(category.Slug, 1, int.MaxValue); foreach (var photo in photos) { var userPhotoActions = _context.FindUserPhotoActionsByPhotoId(photo.PhotoId); var comments = _context.FindCommentsByPhotoId(photo.PhotoId); foreach (var userPhotoAction in userPhotoActions) { _context.Delete(userPhotoAction); _context.SaveChanges(); } foreach (var comment in comments) { _context.Delete(comment); _context.SaveChanges(); } _context.Delete(photo); _context.SaveChanges(); } _context.Delete(category); _context.SaveChanges(); return(RedirectToAction(T4Routes.Category.Manage())); }
public ActionResult Delete(int id) { Photo photo = context.FindPhotoById(id); if (photo == null) { return(HttpNotFound()); } else { context.Delete <Photo>(photo); context.SaveChanges(); return(RedirectToAction("Index")); } }