public ActionResult Index() { var model = new Deviation {Types = _codes, PeriodFromDate = DateTime.Now.ToShortDateString(), PeriodToDate = DateTime.Now.ToShortDateString()}; return View(model); }
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); }