title: Creating a calculator using ASP.Net MVC
body: <p>I'm just starting out using ASP.Net and currently I'm trying to create a simple calculator just using MVC. I have my view layout but I have trouble calling the objects I want. If you know any good guides or helping out with my problem that would be great. For my results action, I am looking at one guide and it is throwing me off with what to do with it.
  View:</p>
  
  <pre><code>    @using CalculatorApp.Models
  @{
      ViewBag.Title = "Index";
  }
  
  @using (Html.BeginForm("Index", "CalcController")) { 
  &lt;div&gt;
      &lt;h2&gt;@Html.Label("Enter first number") : @Html.TextBox("num1")&lt;/h2&gt;
      &lt;h2&gt;@Html.Label("Enter second number") : @Html.TextBox("num2")&lt;/h2&gt;
  &lt;/div&gt;
  &lt;div&gt;   
      &lt;h2&gt;
  
          @Html.RadioButton("calkey", "0") +
             &lt;br&gt;
          @Html.RadioButton("calkey", "1") -
             &lt;br&gt;
          @Html.RadioButton("calkey", "2") *
             &lt;br&gt;
          @Html.RadioButton("calkey", "3") /
      &lt;/h2&gt;            
  &lt;/div&gt;
      &lt;input type="submit" name="Index" value="Index"/&gt;
  }
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>namespace CalculatorApp.Models
  {
      public class Calculations : Controller
      {
          //
          // GET: /Calculations/
          public int num1 { get; set; }
          public int num2 { get; set; }
          public int result { get; set; }
  
          public bool add { get; set; }
          public bool sub { get; set; }
          public bool mult { get; set; }
          public bool div  { get; set; }
      }
  }
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>namespace CalculatorApp.Controllers
  {
      public class CalcController : Controller
      {     
          public ActionResult Index(Calculations calc)
          {
              int selectedFunction = Convert.ToInt32(Request["calkey"]);
  
              switch (selectedFunction)
              {
                  case 0:
                      calc.result = calc.num1 + calc.num2;
                      break;
                  case 1:
                          calc.result = calc.num1 - calc.num2;
                          break;
                  case 2:
                          calc.result = calc.num1 * calc.num2;
                          break;
                  case 3:
                          if (calc.num2 &gt; 0)
                          {
                              calc.result = calc.num1 / calc.num2;
                          }
                          break; 
              }
              return View(calc);
          }
  
          public ActionResult Result(Calculations calc)
          {
  
              return View(calc);
          }
      }
  }
  </code></pre>
  
  <p>The problem I want to solve is how do I make the calculations work when I press the submit button. I have no idea where to begin. </p>