public ActionResult Calculate(UserUI ui) { ViewBag.Title = "Home Page"; ui.AssembleDatesTimes(); _ratesCalculator.FilePath = Server.MapPath("~/App_Data/"); ui.RateDisplay = _ratesCalculator.CalculateRate(ui); return(View("Index", ui)); }
public HttpResponseMessage CalculateRates([FromBody] UserUI userEntry) { HttpResponseMessage response; try { response = ValidateUserEntry(userEntry); if (response.StatusCode == HttpStatusCode.OK) { var rate = _ratesCalculator.CalculateRate(userEntry); response = Request.CreateResponse(HttpStatusCode.OK, rate); } } catch (Exception e) { response = Request.CreateResponse(HttpStatusCode.InternalServerError, e.Message); } return(response); }