public virtual JsonResult Comments_Read([DataSourceRequest] DataSourceRequest request, int?postId) { if (!request.Sorts.Any()) { request.Sorts.Add(new Kendo.Mvc.SortDescriptor("Id", System.ComponentModel.ListSortDirection.Descending)); } var query = _commentBiz.GetList(); if (postId.HasValue) { query = query.Where(c => c.PostId == postId); } return(Json(query.ToDataSourceResult(request), JsonRequestBehavior.AllowGet)); }
public virtual ActionResult Index(int page = 1) { var model = new DashboardModel(); var today = DateTime.Today; model.SitesCount = _siteBusiness.GetList().Count(); model.Feeds = _feedBusiness.GetList().OrderByDescending(f => f.LastUpdateDateTime).Take(10).ToList(); model.ActiveFeedsCount = _feedBusiness.GetList().Where(f => f.Deleted == Common.Share.DeleteStatus.Active).Count(); model.TodayFeedsCount = _feedBusiness.GetList().Where(f => f.LastUpdateDateTime >= today).Count(); model.Comments = _commentBiz.GetList().OrderByDescending(c => c.Id).Take(8).ToList(); model.Posts = _postBiz.GetList().Where(p => p.PostType == PostType.News).OrderByDescending(p => p.Id).Take(8).ToList(); model.PostsCount = _postBiz.GetList().Count(); model.UsersCount = _userBusiness.GetList().Count(); model.Users = _userBusiness.GetList().OrderByDescending(u => u.Id).Take(8).ToList(); model.MessagesCount = _contactBusiness.GetList().Count(); model.TodayItemsCount = _feedItemBusiness.GetList().Where(t => t.CreateDate >= today).Count(); return(View(model)); }