Пример #1
0
        public async Task <IActionResult> GetByXinAndName()
        {
            var xin                  = Request.Query["xin"].ToString();
            var name                 = Request.Query["name"].ToString();
            var id                   = Request.Query["id"].ToString();
            var isPatentAttorney     = Request.Query["isPatentAttorney"].ToString();
            var powerAttorneyFullNum = Request.Query["powerAttorneyFullNum"].ToString();
            var customerTypeId       = Request.Query["customerTypeId"].ToString();

            var stringQuery = string.Join(";", id, xin, name, isPatentAttorney, powerAttorneyFullNum, customerTypeId);

            var dicCustomersRequest = GetDicCustomersRequest.ConstructFromQueryStringParameters(stringQuery);
            var customers           = Executor.GetQuery <GetDicCustomersQuery>().Process(q => q.Execute(dicCustomersRequest));

            if (customers.Any() == false && dicCustomersRequest.HasXin)
            {
                var customer = await _customerUpdater.GetCustomer(dicCustomersRequest.Xin, dicCustomersRequest.IsPatentAttorney);

                if (customer != null)
                {
                    customers = Executor.GetQuery <GetDicCustomersQuery>().Process(q => q.Execute(dicCustomersRequest));
                }
            }
            var result    = customers.ProjectTo <SubjectDto>();
            var pagedList = result.ToPagedList(Request.GetPaginationParams());

            return(pagedList.AsOkObjectResult(Response));
        }
Пример #2
0
        public async Task <IActionResult> GetByXin(string xin, bool?isPatentAttorney)
        {
            var customer = await _customerUpdater.GetCustomer(xin, isPatentAttorney);

            var customerDto = _mapper.Map <DicCustomer, CustomerShortInfoDto>(customer);

            return(Ok(customerDto));
        }