/// <summary> /// 展示图片的详细信息 /// </summary> /// <returns></returns> public ActionResult ShowPhotoDetail() { int pid = Convert.ToInt32(Request["id"]); var photoInfo = PhotoInfoService.LoadEntities(p => p.ID == pid).FirstOrDefault(); ViewBag.PhotoInfo = photoInfo; return(View()); }
public ActionResult AddPhoto(PhotoInfo photoInfo) { photoInfo.AddDate = DateTime.Now; photoInfo.DelFlag = 0; photoInfo.ModifyDate = DateTime.Now; photoInfo.PhotoClassID = Convert.ToInt32(Request["photoClass"]); photoInfo.PicUrls = Request["hiddenUrl"]; PhotoInfoService.AddEntity(photoInfo); return(Content("ok")); }
/// <summary> /// 展示图片信息 /// </summary> /// <returns></returns> public ActionResult GetPhotoInfo() { int pageIndex = Request["page"] != null?int.Parse(Request["page"]) : 1; //当前页码。 int pageSize = Request["rows"] != null?int.Parse(Request["rows"]) : 5; int totalCount; var photoInfoList = PhotoInfoService.LoadPageEntities <int>(pageIndex, pageSize, out totalCount, p => p.DelFlag == 0, p => p.ID, true); var temp = from p in photoInfoList select new { ID = p.ID, Title = p.Title, AddDate = p.AddDate, Author = p.Author, Orgin = p.Orgin, ClassName = p.PhotoClass.ClassName, ImageUrl = p.PicUrls }; return(Json(new { rows = temp, total = totalCount }, JsonRequestBehavior.AllowGet)); }