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"))); } }
// GET: Liters / Gallons public ActionResult LitersToGallons() { LitGalViewModel model = new LitGalViewModel(); return(View(model)); }