// // GET: /Photo/ //打开相册的页面 需要获取此相册内所有照片 public ActionResult Index() { Photo p = new Photo(); string id = Request.QueryString["photo_id"]; if (id != null) { p.Photo_Id = Int32.Parse(id); } PhotoSql ps = new PhotoSql(); //根据 PHOTO ID 获取信息 ps.getPhotoInfo(p); //扔到前台 照片和用户信息 ViewBag.photo = p; ViewBag.user = (User)Session["user"]; //获取此照片所有评论 CommentSql csl = new CommentSql(); Comment c = new Comment(); List <Comment> comment_list = csl.getComments(p.Photo_Id); ViewBag.comment_list = comment_list; return(View()); }
//评论照片 public ActionResult commentPhoto() { Photo p = new Photo(); string id = Request.QueryString["photo_id"]; if (id != null) { p.Photo_Id = Int32.Parse(id); } PhotoSql ps = new PhotoSql(); //根据 PHOTO ID 获取信息 ps.getPhotoInfo(p); ViewBag.photo = p; ViewBag.user = (User)Session["user"]; //获取上传此照片用户的信息 User p_own = ps.getUserByPhoto(p); ViewBag.p_own = p_own; p.Photo_Src.Equals(""); //获取此照片所有评论 CommentSql csl = new CommentSql(); Comment c = new Comment(); List <Comment> comment_list = csl.getComments(p.Photo_Id); ViewBag.comment_list = comment_list; ViewBag.from = Request.QueryString["from"]; ViewBag.kwd = Request.QueryString["keywords"]; return(View()); }
//转到评论页面 传入 Comment Id public ActionResult commentPhoto() { int cid = Int32.Parse(Request.QueryString["comment_id"]); //根据 cid 获取 photo CommentSql cs = new CommentSql(); Photo p = new Photo(); p = cs.getPhotoInfoByCommentId(cid); PhotoSql ps = new PhotoSql(); //根据 PHOTO ID 获取信息 ps.getPhotoInfo(p); ViewBag.photo = p; ViewBag.user = (User)Session["user"]; //获取上传此照片用户的信息 User p_own = ps.getUserByPhoto(p); ViewBag.p_own = p_own; p.Photo_Src.Equals(""); //获取此照片所有评论 CommentSql csl = new CommentSql(); Comment c = new Comment(); List <Comment> comment_list = csl.getComments(p.Photo_Id); ViewBag.comment_list = comment_list; return(View()); }