Example #1
0
 public ActionResult CalculatePremium(int gender, int age)
 {
     try
     {
         var premium = _home.CalculatePremimun(gender, age);
         return(Json(new { ErrorMessage = "Success", Primium = premium }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception)
     {
         //do not throw exception here..
         //pass the custom error message in json to view
         return(Json(new { ErrorMessage = "An error occurred while processing this request" }, JsonRequestBehavior.AllowGet));
     }
 }