示例#1
0
        public IActionResult LengthConvert(decimal numIn)
        {
            ILengthConversions mToF = new MetersToFeet();
            ILengthConversions fToM = new FeetToMeters();
            ILengthConversions mToY = new MetersToYards();
            ILengthConversions yToM = new YardsToMeters();
            ILengthConversions fToY = new FeetToYards();
            ILengthConversions yToF = new YardsToFeet();

            ViewData["NumInput"] = numIn;
            ViewData["MtoF"]     = Math.Round(mToF.GetLength(numIn), 2);
            ViewData["FtoM"]     = Math.Round(fToM.GetLength(numIn), 2);
            ViewData["MtoY"]     = Math.Round(mToY.GetLength(numIn), 2);
            ViewData["YtoM"]     = Math.Round(yToM.GetLength(numIn), 2);
            ViewData["FtoY"]     = Math.Round(fToY.GetLength(numIn), 2);
            ViewData["YtoF"]     = Math.Round(yToF.GetLength(numIn), 2);

            return(View());
        }