示例#1
0
 public ActionResult Index()
 {
     var model = new Deviation {Types = _codes, PeriodFromDate = DateTime.Now.ToShortDateString(), PeriodToDate = DateTime.Now.ToShortDateString()};
     return View(model);
 }
示例#2
0
 public ActionResult Index(Deviation deviation)
 {
     if(!ModelState.IsValid)
         return View(deviation);
     return RedirectToAction("Index");
 }
 public void ShouldGetErrorWhenFromDateIsGreaterThanToDate()
 {
     var deviation = new Deviation {PeriodFromDate = "2012-10-10", PeriodToDate = "2012-10-01"};
     _validator.ShouldHaveValidationErrorFor(x => x.PeriodToDate, deviation);
 }