public JsonResult Point(Pic_Point picpoint, int Pic_ID) { var picture = db.Picture.Find(Pic_ID); int picid = Pic_ID; int UID = Convert.ToInt32(Session["UID"].ToString()); var list = new List <PointList>(); int chk_member = db.Pic_Point.Where(o => o.UID == UID).Where(o => o.Pic_ID == picid).Count(); if (chk_member != 1) { if (ModelState.IsValid) { picpoint.Pic_ID = picid; picpoint.UID = UID; picpoint.PP_Time = DateTime.Now; db.Pic_Point.Add(picpoint); db.SaveChanges(); } } var sum = db.Pic_Point.Where(a => a.Pic_ID == picid).ToList().Count(); for (int i = 1; i <= 1; i++) { PointList pl = new PointList(); pl.sum = sum; pl.succ = chk_member; list.Add(pl); } return(Json(list)); }
public ActionResult Details(int id) { Session["Pic_ID"] = id; Picture pictures = db.Picture.Find(id); Pic_Point pp = db.Pic_Point.Find(id); var picpoint = from p in db.Pic_Point.Where(p => p.Pic_ID == id) select p; var pictures1 = from p in db.Picture.OrderByDescending(p => p.Pic_Time) select p; var pic_comment = from pc in db.Pic_Comment.Where(p => p.Pic_ID == id).OrderByDescending(p => p.PC_Time) select pc; var index = new SEEWeb.ViewModel.PictureViewModel() { Picture1 = pictures, Pictures = pictures1, Pic_Point = picpoint, Pic_Comment = pic_comment, }; return(View(index)); }