30 Temmuz 2018 Pazartesi

Tüm TimeZone'ları çekip veritabanına ekleme

            var tzCollection = TimeZoneInfo.GetSystemTimeZones();
            var timeZoneTypes = new List<TimeZoneType>();
            foreach (var timeZoneInfo in tzCollection)
            {
                var timeZoneType = new TimeZoneType
                {
                    TimeZoneInfoId = timeZoneInfo.Id,
                    DaylightName = timeZoneInfo.DaylightName,
                    DisplayName = timeZoneInfo.DisplayName,
                    StandardName = timeZoneInfo.StandardName,
                    SupportsDaylightSavingTime = timeZoneInfo.SupportsDaylightSavingTime,
                    Ticks = timeZoneInfo.BaseUtcOffset.Ticks
                };
                timeZoneTypes.Add(timeZoneType);
            }
            foreach (var timeZoneType in timeZoneTypes)
            {
                db.TimeZoneTypes.Add(timeZoneType);

                db.Commit();
            }


Hiç yorum yok:

Yorum Gönder

.net 6 mapget kullanımı

 app.UseEndpoints(endpoints => {     endpoints.MapGet("/", async context =>     {         var response = JsonConvert.Seriali...