10 Ekim 2016 Pazartesi

ASP.NET MVC DayOfWeek

 public ActionResult Index()
        {
            string gun = DateTime.Now.DayOfWeek.ToString();
            if(gun == "Monday")
            {
                ViewBag.gun = "Pazartesi";
            }
            else if(gun == "Tuesday")
            {
                ViewBag.gun = "Salı";
            }
            else if (gun == "Wednesday")
            {
                ViewBag.gun = "Çarşamba";
            }
            else if (gun == "Thursday")
            {
                ViewBag.gun = "Perşembe";
            }
            else if (gun == "Friday")
            {
                ViewBag.gun = "Cuma";
            }
            else if (gun == "Saturday")
            {
                ViewBag.gun = "Cumartesi";
            }else
            {
                ViewBag.gun = "Pazar";
            }
            return View();
        }

Hiç yorum yok:

Yorum Gönder