Exemplo n.º 1
0
        public IActionResult ShowCalculationResultsx(MathOperation data)
        {
            switch (operation.Operator)
            {
            case "+":
                data.Result = MathLibrary.Add(data.LeftOperand, data.RightOperand)
                              break;

            case "-":
                data.Result = MathLibrary.Subtract(data.LeftOperand, data.RightOperand)
                              break;

            case "*":
                data.Result = MathLibrary.Multiply(data.LeftOperand, data.RightOperand)
                              break;

            case "/":
                data.Result = MathLibrary.Divide(data.LeftOperand, data.RightOperand)
                              break;
                default;
                break;
            }
            return(View(data));
        }