예제 #1
0
        public LoadDistrictReponse GetDistrict(int userId)
        {
            _logger.LogInformation($"Invoking endpoint: {this.HttpContext.Request.GetDisplayUrl()}");
            try
            {
                var district = _webMasterService.RetrieveDistrict(userId);

                _logger.LogInformation($"Received district master data {district}");
                return(district.Count == 0 ?
                       new LoadDistrictReponse {
                    Status = "true", Message = "No record found", District = new List <LoadDistricts>()
                }
                    : new LoadDistrictReponse {
                    Status = "true", Message = string.Empty, District = district
                });
            }
            catch (Exception e)
            {
                _logger.LogError($"Error in receiving district data {e.StackTrace}");
                return(new LoadDistrictReponse {
                    Status = "false", Message = e.Message, District = null
                });
            }
        }