Example #1
0
 public IActionResult Get()
 {
     try
     {
         var result = _countryRepository.GetAll();
         if (result.Any())
         {
             _logger.LogInformation("Successfully recieved Country Data.");
             return(Ok(result));
         }
         else
         {
             _logger.LogError("No country data. Data - {0}", result);
             return(StatusCode(400, StatusCodes.ReturnStatusObject("No country data.")));
         }
     }
     catch (Exception e)
     {
         _logger.LogError("Error recieving data. Error - {0}. Data - {1}", e.Message);
         return(StatusCode(400, StatusCodes.ReturnStatusObject("Error recieving Country data.")));
     }
 }
Example #2
0
 public List <SelectListItem> GetAll()
 {
     return(_countryService.GetAll());
 }
Example #3
0
        public async Task <ActionResult <IEnumerable <Country> > > GetAllCountry()
        {
            var countries = await repository.GetAll();

            return(StatusCode(StatusCodes.Status200OK, countries));
        }
Example #4
0
 public IEnumerable <CountryDTO> GetCountry()
 {
     return(Counobj.GetAll());
 }
Example #5
0
        public IActionResult Get()
        {
            var results = _country.GetAll();

            return(Ok(results));
        }