public ActionResult LeapYearsForm(LeapYearsValidation request) { if (ModelState.IsValid) { var calc = new LeapYearCalculation(); //set tipdata to the request var tipdata = new LeapYearRequest(); //set the validated inputs to the new request tipdata.BeginningDate = request.BeginningDate.Value; tipdata.EndingDate = request.EndingDate.Value; //set the result equal to the result of the the caculated method (returns a response) var result = calc.TotalDates(tipdata.BeginningDate, tipdata.EndingDate); //return a view linking to "LeapYearsResult" and pass in the result return View("LeapYearsResult", result); } else { return View(request); } }
public ActionResult LeapYearsForm() { var model = new LeapYearsValidation(); return View(model); }