Exemplo n.º 1
0
        public IActionResult ConvertTemp(ConverterViewModel model)
        {
            switch (model.ConversionType)
            {
            case "CtoF":
                var CtoF = new MyTempetureConverter();
                model.ConvertedValue = CtoF.CelciustoFahrenheit(model.ValuetoConvert);
                break;

            case "CtoK":
                var CtoK = new CtoKConverter();
                model.ConvertedValue = CtoK.CelciustoKelvin(model.ValuetoConvert);
                break;

            case "FtoC":
                var FtoC = new FtoCConverter();
                model.ConvertedValue = FtoC.FahrenheittoCelcius(model.ValuetoConvert);
                break;

            case "FtoK":
                var FtoK = new FtoKConverter();
                model.ConvertedValue = FtoK.FahrenheittoKelvin(model.ValuetoConvert);
                break;

            default:
                break;
            }
            return(View(model));
        }
Exemplo n.º 2
0
        public decimal FtoK(string type, string unitvalue)
        {
            decimal       v      = Convert.ToDecimal(unitvalue);
            FtoKConverter cc     = new FtoKConverter();
            decimal       result = cc.FahrenheittoKelvin(v);

            return(result);
        }