public ActionResult GetGreenBoxes(TaskListSearchModel model) { var actions = new List <App.UI.Models._Action>(); model.OuteCome = (int)StatusKey.Completed; var CurrentTaskList = GetTasklist(model);// db.TaskLists.Where(w => w.OutCome == (int)StatusKey.Completed).DefaultIfEmpty().First<TaskListModel>(); if (CurrentTaskList != null) { actions.Add(new App.UI.Models._Action { Id = 1, Title = "new", TranslatedTitle = "مشاهده گردش", Link = "/Person", Icon = "fa-star" }); actions.Add(new App.UI.Models._Action { Id = 2, Title = "action1", TranslatedTitle = "برگشت به نفر قبل", Link = "/Person", Icon = "fa-tasks" }); Parallel.ForEach(CurrentTaskList.Items, i => { i.Actions = actions; }); } return(Json(CurrentTaskList)); }
protected PagedList <TaskListModel> GetTasklist(TaskListSearchModel model) { AllItems = db.TaskLists.Include(i => i.ProjectInfo).Include(i => i.EvaluationPeriod) .Include(i => i.SenderProjectMember).ThenInclude(ti => ti.Persone) .Include(i => i.SenderProjectMember).ThenInclude(ti => ti.RoleOrgs) .Include(i => i.ReciverProjectMember).ThenInclude(ti => ti.Persone) .Include(i => i.ReciverProjectMember).ThenInclude(ti => ti.RoleOrgs).Where(w => w.EvaluationPeriod.State == 1) .ToList(); var filtered = AllItems; if (model.Title != null) { filtered = filtered.Where(x => x.Title.Contains(model.Title)).ToList(); } if (model.OuteCome != null) { filtered = filtered.Where(w => w.OutCome == model.OuteCome).ToList(); } if (model.ProjectInfo != null) { filtered = filtered.Where(w => w.ProjectInfo.Title.Contains(model.ProjectInfo)).ToList(); } //if (model.Description != null) // filtered = filtered.Where(x => x.Description.Contains(model.Description)).ToList(); PagedList <TaskListModel> result = new PagedList <TaskListModel>(); result.Items = filtered.Skip((model.PageIndex * model.PageSize)).Take(model.PageSize).ToList(); result.PageIndex = model.PageIndex; result.PageSize = model.PageSize; result.TotalItemsCount = filtered.Count; return(result); }
public ActionResult GetAllPaged(TaskListSearchModel model) { return(Ok(GetTasklist(model))); }