public async Task <IHttpActionResult> GetCarByCustomerId(string customerId = "")
        {
            if (customerId == "")
            {
                return(Ok(SuccessResult(new DTOCar())));
            }

            var result = await CallAsyncWithRetry(() => _carService.GetSpecifyCarByCustomerIdAsync(customerId));

            if (!result.HasErrors)
            {
                var allBranches = await CallAsyncWithRetry(() => _branchService.GetAllAsync());

                var allManufacturers = await CallAsyncWithRetry(() => _manufacturerService.GetAllAsync());

                result.Target.Branches      = !allBranches.HasErrors ? allBranches.Target : new List <DTOBranch>();
                result.Target.Manufacturers = !allManufacturers.HasErrors ? allManufacturers.Target : new List <DTOManufacturer>();

                var successResult = SuccessResult(result.Target);
                return(Ok(successResult));
            }

            var errorResult = ErrorResult(result.Errors);

            return(Content(HttpStatusCode.InternalServerError, errorResult));
        }
        public async Task <IHttpActionResult> Get(string customerId = "")
        {
            var result = await CallAsyncWithRetry(() => _customerService.GetCustomerByIdAsync(customerId));

            if (!result.HasErrors)
            {
                var allBranches = await CallAsyncWithRetry(() => _branchService.GetAllAsync());

                var allCustomerTypes = await CallAsyncWithRetry(() => _customerTypeService.GetAllAsync());

                result.Target.Branches      = !allBranches.HasErrors ? allBranches.Target : new List <DTOBranch>();
                result.Target.CustomerTypes = !allCustomerTypes.HasErrors ? allCustomerTypes.Target : new List <DTOCustomerType>();

                // need to resolve this section
                var branchResult = await _branchService.GetByIdAsync(result.Target.BranchId);

                if (!branchResult.HasErrors)
                {
                    result.Target.BranchName = branchResult.Target.Name;
                }

                var customerTypeResult = await _customerTypeService.GetByIdAsync(result.Target.CustomerTypeId);

                if (!customerTypeResult.HasErrors)
                {
                    result.Target.CustomerTypeName = customerTypeResult.Target.Name;
                }
                // end

                var successResult = SuccessResult(result.Target);
                return(Ok(successResult));
            }

            var errorResult = ErrorResult(result.Errors);

            return(Content(HttpStatusCode.InternalServerError, errorResult));
        }