Ejemplo n.º 1
0
        public ViewResult LitersToGallons(LitGalViewModel model)
        {
            try
            {
                Liters2Gallons measurement = new Liters2Gallons();
                model.Result = measurement.Convert(model.Choice, model.Measurement);
                ModelState.Clear();

                return(View(model));
            }
            catch (InvalidCastException ex)
            {
                return(View("Error", new HandleErrorInfo(ex, "Converter", "Error")));
            }
            //This catch block will catch other types of unhandled exceptions
            catch (Exception ex)
            {
                return(View("Error", new HandleErrorInfo(ex, "Converter", "Error")));
            }
        }
Ejemplo n.º 2
0
        // GET: Liters / Gallons
        public ActionResult LitersToGallons()
        {
            LitGalViewModel model = new LitGalViewModel();

            return(View(model));
        }