public ActionResult GetStudyItems() { int StudyOnlineID = int.Parse(Request["key"] ?? "0"); int pageSize = int.Parse(Request["rows"] ?? "10"); int pageIndex = int.Parse(Request["page"] ?? "1"); var dd = StudyOnlineService.GetEntity(u => u.ID == StudyOnlineID).FirstOrDefault(); var temp = StudyItemService.GetEntity(u => u.DelFlag == true && u.StudyOnlineID == StudyOnlineID); var list = temp.OrderByDescending(t => t.RegTime).Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList(); var data = list.Select(d => new { d.ID, d.Context, d.RegTime, d.UserInfo.Icon, d.UserInfoID }).ToList(); var count = Convert.ToInt32(Math.Ceiling((double)temp.Count() / pageSize)); var str = HNCJ.DY.Common.PageBar.GetPageBar(pageIndex, count, "talk", StudyOnlineID); return(Json(new { datas = data, str = str, Title = dd.Name, Content = dd.Content }, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(int id = 0) { var model = StudyItemService.GetEntity(u => u.DelFlag == true && u.ID == id).FirstOrDefault(); var data = StudyOnlineService.GetEntity(u => u.DelFlag == true && u.Status == 1).ToList(); var list = (from u in data select new SelectListItem { Text = u.Name, Value = u.ID.ToString(), Selected = false }).ToList(); foreach (var item in list) { if (item.Value.Equals(model.StudyOnlineID.ToString())) { item.Selected = true; } } ViewData["StudyOnlineID"] = list; ViewData.Model = model; return(View()); }
public ActionResult Details(int id = 0) { ViewData.Model = StudyItemService.GetEntity(u => u.DelFlag == true && u.ID == id).FirstOrDefault(); return(View()); }