public async Task <IEnumerable <KeyValuePair <string, IEnumerable <FlowLineCond> > > > HandleRequestAsync(WorkFlowDto request) { var query = from a in flowLines join b in flowLineConds on a.Id equals b.FlowLink_Id where a.WorkFlow_Id == request.Id select b; var list = await query.ToListAsync(); return(list.GroupBy(v => v.FlowLink_Id).Select(v => new KeyValuePair <string, IEnumerable <FlowLineCond> >(v.Key, v))); }
public async Task <IEnumerable <KeyValuePair <string, IEnumerable <RoleViewModel> > > > HandleRequestAsync(WorkFlowDto request) { var roleViews = roles.MapTo <Role, RoleViewModel>(); var query = from a in flowNodes join b in flowNodeRoles on a.Id equals b.FlowNode_Id join c in roleViews on b.Role_Id equals c.Id where a.WorkFlow_Id == request.Id select new { b.FlowNode_Id, Role = c }; var list = await query.ToListAsync(); return(list.GroupBy(v => v.FlowNode_Id).Select(v => new KeyValuePair <string, IEnumerable <RoleViewModel> >(v.Key, v.Select(r => r.Role)))); }
public async Task <IEnumerable <KeyValuePair <string, IEnumerable <UserViewModel> > > > HandleRequestAsync(WorkFlowDto request) { var userViewModels = users.MapTo <User, UserViewModel>(); var query = from a in flowNodes join b in flowNodeUsers on a.Id equals b.FlowNode_Id join c in userViewModels on b.User_Id equals c.Id where a.WorkFlow_Id == request.Id select new { b.FlowNode_Id, User = c }; var list = await query.ToListAsync(); return(list.GroupBy(v => v.FlowNode_Id).Select(v => new KeyValuePair <string, IEnumerable <UserViewModel> >(v.Key, v.Select(r => r.User)))); }