コード例 #1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var model = await _context.Channels.FirstOrDefaultAsync(m => m.Id == id);

            if (model == null)
            {
                return(NotFound());
            }

            Channel = model.ToChannelEditModel();

            Countries = TZNames.GetCountryNames(CultureInfo.CurrentUICulture.Name)
                        .Select(x =>
                                new SelectListItem(x.Value, x.Key, x.Key == model.CountryCode));

            TimeZones = TimeZonesData.GetForCountry(model.CountryCode, null)
                        .Select(x =>
                                new SelectListItem(x.Value, x.Key, x.Key == model.TimeZoneId));

            return(Page());
        }
コード例 #2
0
 public IDictionary <string, string> Get(string countryCode, DateTimeOffset?threshold)
 {
     return(TimeZonesData.GetForCountry(countryCode, threshold));
 }