Пример #1
0
        public DemoModel(IWebAddressVerification addressVerification)
        {
            _webAddressVerification = addressVerification;
            Input = new AddAdress();

            CountrySelectItems = new List <SelectListItem>();
            ResponseDetails    = new List <ResponseDetail>();
            try
            {
                var CountryCodes = _webAddressVerification.CountryCodeGetAll();

                foreach (var a in CountryCodes)
                {
                    CountrySelectItems.Add(new SelectListItem()
                    {
                        Value = a.Iso2Code, Text = a.CountryName
                    });
                }
                CountrySelectItems.Insert(0, new SelectListItem()
                {
                    Value = "", Text = "select a country"
                });
            }
            catch (Exception e)
            {
                ErrorMessage = e.Message;
            }
        }
Пример #2
0
 public ActionResult <List <CountryCode> > GetAll()
 {
     try
     {
         var CountrycodeList = _webAddressVerification.CountryCodeGetAll();
         if (CountrycodeList?.Count > 0)
         {
             return(Ok(CountrycodeList));
         }
         else
         {
             return(NotFound());
         }
     }
     catch (Exception e)
     {
         _logger.LogError(e.Message, e.StackTrace);
         return(StatusCode(500));
     }
 }