public ActionResult Delete(int id) { Photo photo = DB.Photos.Get(id); if (photo != null) { if (OnlineUsers.CurrentUserIsAdmin() || photo.IsOwner(OnlineUsers.GetSessionUser())) { return(View(photo)); } } return(RedirectToAction("Index")); }