示例#1
0
        public IActionResult ManualParsingInSeparateActionsPOST()
        {
            OperationsModel OM = new OperationsModel();

            OM.value1    = Int16.Parse(Request.Form["value1"]);
            OM.value2    = Int16.Parse(Request.Form["value2"]);
            OM.operation = Request.Form["operation"];
            OM.compute();
            return(View("Result", OM));
        }
示例#2
0
 public IActionResult ModelBindingInParameters(int value1, int value2, string operation)
 {
     if (Request.Method.Equals("POST", StringComparison.OrdinalIgnoreCase))
     {
         OperationsModel OM = new OperationsModel();
         OM.value1    = value1;
         OM.value2    = value2;
         OM.operation = operation;
         OM.compute();
         return(View("Result", OM));
     }
     else
     {
         return(View());
     }
 }
示例#3
0
 public IActionResult ManualParsingInSingleAction()
 {
     if (Request.Method.Equals("POST", StringComparison.OrdinalIgnoreCase))
     {
         OperationsModel OM = new OperationsModel();
         OM.value1    = Int32.Parse(Request.Form["value1"]);
         OM.value2    = Int16.Parse(Request.Form["value2"]);
         OM.operation = Request.Form["operation"];
         OM.compute();
         return(View("Result", OM));
     }
     else
     {
         return(View());
     }
 }
示例#4
0
 public IActionResult ModelBindingInSeparateModel(OperationsModel OM)
 {
     OM.compute();
     return(View("Result", OM));
 }