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)); }
public double CmToInchesTest(double cm) { var length = new MetricsLength(); return(Math.Round(length.ConvertCmToInches(cm), 2)); }