Beispiel #1
0
        public ActionResult Index(string quantity, string type, int kilo)
        {
            var model = new CalculatorModel();
            var index = model.ValueOptions.IndexOf(type);
            if (index % 2 == 0)
            {
                model.DataValues[0] = Math.Pow(kilo, index/2) * int.Parse(quantity);
                model.DataValues[1] = model.DataValues[0] / 8;
            }
            else
            {
                model.DataValues[0] = Math.Pow(kilo, index / 2) * 8 * int.Parse(quantity);
                model.DataValues[1] = Math.Pow(kilo, index / 2) * int.Parse(quantity);
            }

            for (int i = 2; i < model.DataValues.Length; i++)
            {
                model.DataValues[i] = model.DataValues[i - 2] / kilo;
            }


            return View(model);
        }
Beispiel #2
0
 public ActionResult Index()
 {
     var model = new CalculatorModel();
     return View(model);
 }