public CountryDetail GetCountry(string countryCode) { //owner? // https://docs.microsoft.com/en-us/dotnet/api/system.web.httpcontext.user?view=netframework-4.8 // https://docs.microsoft.com/en-us/dotnet/api/system.security.claims.claim?view=netcore-3.1 var user = User.Identity.Name; int id = -1; foreach (var claim in User.Claims) { if (claim.Type == "sub") { id = int.Parse(claim.Value); } } System.Diagnostics.Debug.WriteLine("".PadRight(20, '-') + " from GetCounty " + "".PadRight(20, '-')); System.Diagnostics.Debug.WriteLine("User: "******"User id: " + id); Country country = countryDAO.GetCountry(countryCode); CountryDetail countryDetail = new CountryDetail(country); //get news NewsAPIService newsAPIService = new NewsAPIService(); countryDetail = newsAPIService.GetCountry(countryDetail); return(countryDetail); }
public CountryDetail GetCountry(string countryCode) { Country country = countryDao.GetCountry(countryCode); CountryDetail countryDetail = new CountryDetail(country); //get news NewsAPIService newsAPIService = new NewsAPIService(); countryDetail = newsAPIService.GetCountry(countryDetail); return(countryDetail); }