21 Şubat 2017 Salı

Asp .Net MVC tarih, sayı format sorunu

protected override IAsyncResult BeginExecuteCore(AsyncCallback callback, object state)
        {
         
            string cultureName;

            // Attempt to read the culture cookie from Request
            var cultureCookie = Request.Cookies["_culture"];
            if (cultureCookie != null)
                cultureName = cultureCookie.Value;
            else
                cultureName = Request.UserLanguages != null && Request.UserLanguages.Length > 0 ?
                        Request.UserLanguages[0] :  // obtain it from HTTP header AcceptLanguages
                        null;
            // Validate culture name
            cultureName = CultureHelper.GetImplementedCulture(cultureName); // This is safe

            // Modify current thread's cultures          
            var currentCulture = new CultureInfo(cultureName)
            {
                DateTimeFormat =
                {
                    ShortDatePattern = "dd/MM/yyyy",
                    DateSeparator = "/"
                },
                NumberFormat =
                {
                    NumberDecimalDigits = 4,
                    NumberDecimalSeparator = ".",
                    NumberGroupSeparator = ","
                }
            };
            Thread.CurrentThread.CurrentCulture = currentCulture;
            Thread.CurrentThread.CurrentUICulture = currentCulture;
            return base.BeginExecuteCore(callback, state);
        }

Hiç yorum yok:

Yorum Gönder

.net 6 mapget kullanımı

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