예제 #1
0
 public ActionResult Index(string num1, string num2, string dropdownlist1)
 {
     var numa = num1;
     var numb = num2;
     var selectvalue =dropdownlist1;
     WebService1SoapClient web = new WebService1SoapClient();
     var result = "";
     if (selectvalue.Equals("+"))
     {
         result = (web.addition(double.Parse(numa), double.Parse(numb))).ToString();
     }
     else if (selectvalue.Equals("-"))
     {
         result = (web.subtract(double.Parse(numa), double.Parse(numb))).ToString();
     }
     else if (selectvalue.Equals("*"))
     {
         result = (web.multiplication(double.Parse(numa), double.Parse(numb))).ToString();
     }
     else if (selectvalue.Equals("/"))
     {
         result = (web.division(double.Parse(numa), double.Parse(numb))).ToString();
     }
     else
     {
         result = "非法计算方式";
     }
     ViewBag.result = result;
     return View();
 }