Exemplo n.º 1
0
        [HttpPost] // Allows browser to know that you are making a POST request.
        public ActionResult Index(Calculator calculatorVM) // Parameter Calculator is data type, calculatorVM is the name
        {

            calculatorVM.Result = calculatorVM.Number1 + calculatorVM.Number2; 
        
           return View(calculatorVM);
        }
        // POST: Calculator
        // The ActionResult class represents the result of an action method.

        public ActionResult Index(Calculator calculatorVM )
        {
            calculatorVM.Result = calculatorVM.Number1 + calculatorVM.Number2;

            // The view object renders a view to the response.
            // Return the updated object of the View Model class to the view.
            // In the view, the @model reference will allow you to
            return View(calculatorVM);
        }