コード例 #1
0
        public IActionResult Length(Metric model)
        {
            var length = new MetricsLength();

            var newModel = new Metric();

            if (model.Cm == null)
            {
                newModel.Cm = Math.Round(length.ConvertInchesToCm((double)model.Inches), 2);
            }
            else if (model.Inches == null)
            {
                newModel.Cm = Math.Round(length.ConvertCmToInches((double)model.Cm), 2);
            }
            else
            {
                newModel.Cm     = Math.Round(length.ConvertInchesToCm((double)model.Inches), 2);
                newModel.Inches = Math.Round(length.ConvertCmToInches((double)model.Cm), 2);
            }

            return(View("Index", newModel));
        }
コード例 #2
0
ファイル: MetricsTests.cs プロジェクト: villagef/webCalc
        public double InchesToCmTest(double inc)
        {
            var length = new MetricsLength();

            return(Math.Round(length.ConvertInchesToCm(inc), 2));
        }