Example #1
0
        public async Task <ApiResult> GetOrgUserByUserID(int userId)
        {
            ApiResult ret = new ApiResult();

            try
            {
                OrgTree orgTree = await _findTopNode(userId);// await _orgRepo.GetOrgUserByUserID(userId);

                if (orgTree != null)
                {
                    ret = await GetOrgByIDs(new List <int> {
                        orgTree.Id
                    });
                }
                else
                {
                    ret = await GetAllOrg();
                }
                List <OrgUser> users = await _orgRepo.ListAllOrgUser();

                ret.data = _mountUsers(ret.data as List <object>, users);
            }
            catch (Exception ex)
            {
                ret.code = Code.Failure;
                ret.msg  = ex.Message;
            }

            return(ret);
        }