示例#1
0
        public static GetDocumentByIdResponse GetDocumentById(GetDocumentByIdRequest getDocumentByIdRequest)
        {
            try
            {
                var responseContent = DoPostRequest("https://api.peoplehr.net/EmployeeDocument", getDocumentByIdRequest);
                var response        = JsonConvert.DeserializeObject <PeopleHrResponse>(responseContent);

                if (response.isError)
                {
                    return(new GetDocumentByIdResponse
                    {
                        isError = response.isError,
                        Message = response.Message,
                        Status = response.Status
                    });
                }

                return(JsonConvert.DeserializeObject <GetDocumentByIdResponse>(responseContent));
            }
            catch (Exception error)
            {
                throw new PeopleHrClientException("Unable to perform GetDocumentById", error);
            }
        }
示例#2
0
 public async Task <IHttpActionResult> GetById([FromUri] GetDocumentByIdRequest request)
 {
     request.TenantId = (await _userManager.GetUserAsync(User)).TenantId;
     return(Ok(await _mediator.Send(request)));
 }