public IActionResult OverrideAppWideDefaultsInView()
        {
            var model = new DateModel
            {
                MyDate = new DateTimeOffset(
                year: 2000,
                month: 1,
                day: 2,
                hour: 3,
                minute: 4,
                second: 5,
                millisecond: 60,
                offset: TimeSpan.FromHours(0))
            };

            ModelState.AddModelError("Error", "An error occurred.");
            return View(model);
        }
Пример #2
0
        public IActionResult OverrideAppWideDefaultsInView()
        {
            var model = new DateModel
            {
                MyDate = new DateTimeOffset(
                    year: 2000,
                    month: 1,
                    day: 2,
                    hour: 3,
                    minute: 4,
                    second: 5,
                    millisecond: 60,
                    offset: TimeSpan.FromHours(0))
            };

            ModelState.AddModelError("Error", "An error occurred.");
            return(View(model));
        }