//
        // GET: /Flooring/
        public ActionResult Index()
        {
            var rates = new CostsPerSqFoot();

            var model = new CostDetails(rates.RatesList);

            return View(model);
        }
        public ActionResult Calculations(CostDetails model)
        {
            var rates = new CostsPerSqFoot();

            if (ModelState.IsValid)
            {
                model.SelectedRate = rates.RatesList.FirstOrDefault(s => s.Id == model.SelectedId);
                model.CalculateTotalCosts(model);
                return View(model);
            }

            else
                return View("Index", model);
        }
Beispiel #3
0
        public void CalculateTotalCosts(CostDetails model)
        {
            model.Measurements.Area = model.Measurements.Length * model.Measurements.Width;

            TotalCosts = model.Measurements.Area * model.Prices.Rate;
        }