public async Task <IEnumerable <CompanyTreeViewResponse> > GetCompanyTree(CompanyTreeViewRequest request, SystemSession session)
        {
            var serviceRequest = new CompanyTree
            {
                UserId               = session.UserId,
                IgnoreSisters        = request.IgnoreSisters,
                ShowChildCompanyOnly = request.ShowChildCompaniesOnly
            };
            var response = await Task.Factory.StartNew(() => Client.UserService.getCompanyTree(serviceRequest, session.GetSession())).ConfigureAwait(false);

            var result = response.Select(x => new CompanyTreeViewResponse
            {
                UserId      = x.UserId,
                ChildId     = x.ChildId,
                Name        = x.Name,
                Level       = x.Level,
                IsRequestee = x.IsRequestee
            });

            return(result);
        }
示例#2
0
 // PUT api/<controller>/5
 /// <summary>
 /// Puts the specified identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="value">The value.</param>
 /// <returns></returns>
 /// <exception cref="HttpResponseException"></exception>
 public CompanyTree Put(string id, [FromBody] CompanyTree value)
 {
     return(CompanyTreeManager.UpdateItem(value));
 }
示例#3
0
 // POST api/<controller>
 /// <summary>
 /// Posts the specified value.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <returns></returns>
 public CompanyTree Post([FromBody] CompanyTree value)
 {
     return(CompanyTreeManager.AddItem(value));
 }