public async Task <ActionResult <TaskInstanceModel> > Get(int id) { var item = await this.taskManager.CreateQuery() .SetId(id) .SingleAsync(); if (item != null) { return(TaskInstanceModel.Create(item)); } return(this.NotFound()); }
public virtual async Task <ActionResult <PagedResult <TaskInstanceModel> > > Get([FromBody] TaskInstanceFilter filter) { var result = new PagedResult <TaskInstanceModel>(); if (filter == null) { filter = new TaskInstanceFilter(); } var query = this.taskManager.CreateQuery() .SetAssignee(filter.Assignee); var list = await query.ListAsync(filter.Page, filter.PageSize); result.Count = await query.CountAsync(); result.Items = list.Select(x => TaskInstanceModel.Create(x)).ToList(); result.Page = filter.Page; result.PageSize = filter.PageSize; return(result); }