public async Task <IActionResult> GetCustomerAsync([FromQuery] CustomerIdQueryRequestModel model)
        {
            try
            {
                var result = await this.customerIdQueryHandler.GetCustomerAsync(model);

                if (result != null)
                {
                    return(Ok(result));
                }
                return(NotFound($"Customer Id '{model.CustomerId}' does not exists!!"));
            }
            catch
            {
                throw;
            }
        }
Exemple #2
0
        public async Task <CustomerIdQueryResponseModel> GetCustomerAsync(CustomerIdQueryRequestModel requestModel)
        {
            var result = await this.context.PersonalDetails.Where(p => p.Id == requestModel.CustomerId)
                         .FirstOrDefaultAsync();

            if (result != null)
            {
                return(new CustomerIdQueryResponseModel
                {
                    CustomerId = result.Id,
                    Name = $"{result.Title}.{result.Name}",
                    City = result.City
                });
            }

            return(null);
        }