コード例 #1
0
 public ActionResult Suma(Calcular s)
 {
     if (ModelState.IsValid)
     {
         ViewBag.r = "La SUMA es: " + (s.num1 + s.num2).ToString();
         return this.View();
     }
     return View();
 }
コード例 #2
0
 public ActionResult Multiplicacion(Calcular m)
 {
     if (ModelState.IsValid)
     {
         ViewBag.r = "La MULTIPLICACION es: " + (m.num1 * m.num2).ToString();
         return this.View();
     }
     return View();
 }
コード例 #3
0
 public ActionResult Resta(Calcular r)
 {
     if (ModelState.IsValid)
     {
         ViewBag.r = "La RESTA es: " + (r.num1 - r.num2).ToString();
         return this.View();
     }
     return View();
 }
コード例 #4
0
 public ActionResult Division(Calcular d)
 {
     if (ModelState.IsValid)
     {
         if (d.num2 == 0)
         {
             ViewBag.r = "ERROR...El denominador no puede ser 0 (cero)...";
         }
         else
         {
             ViewBag.r = "La DIVISION es: " + (d.num1 / d.num2).ToString();
             return this.View();
         }
     }
     return View();
 }