public ActionResult GetTollFee(TollTimes contact, IFormCollection form) { var dateTravelled = Request.Form["StartDate"]; var vehcileType = Request.Form["VehicleList"].ToString(); var tollCount = Request.Form["TollCount"].ToString(); var tollCrossedTimes = Request.Form["MyMappings"].ToString(); contact.MyMappings = tollConfig.Value.MyMappings; contact.VehicleList = tollConfig.Value.VehicleList; ViewBag.IsShow = false; if (Request.Form["Calculate"].ToString() != string.Empty) { if (ModelState.IsValid) { ViewBag.IsShow = true; if (IsTollFreeVehicle(vehcileType)) { contact.SumAmount = 0; return(View("Home", contact)); } if (IsTollFreeDate(Convert.ToDateTime(dateTravelled))) { contact.SumAmount = 0; return(View("Home", contact)); } contact.SumAmount = GetTotalTollFee(tollCrossedTimes); } } return(View("Home", contact)); }
/// <summary> /// /// </summary> /// <returns></returns> public IActionResult Home() { TollTimes tollTimes = new TollTimes(); tollTimes.VehicleList = tollConfig.Value.VehicleList; tollTimes.MyMappings = tollConfig.Value.MyMappings; ViewBag.IsShow = false; return(View(tollTimes)); }