> For the complete documentation index, see [llms.txt](https://raviram.gitbook.io/mvc-module-1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://raviram.gitbook.io/mvc-module-1/exercise/add-two-numbers/improvisation.md).

# Improvisation

## Improvising the previous code

let us do the below improvisations, now that we have understood the basics

### Code behind

```csharp
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc;

public class IndexModel : PageModel
{
    [BindProperty]
    public int FirstNum { get; set; }
    
    [BindProperty]
    public int SecondNum { get; set; }
    
    public int Result { get; set; }
    
    public void OnGet(){ }

    public void OnPost()
    {
        Result = FirstNum + SecondNum;        
    }
}
```

### Mark up

```cshtml
@page
@model IndexModel

<form method="post">
    @Html.AntiForgeryToken()

    <label>Enter the first number:</label>
    <input type="number" name="FirstNum" required>

    <label>Enter the second number:</label>
    <input type="number" name="SecondNum" required>

    <button type="submit">Add</button>
</form>


@if(@Model.Result!=0){
    <p>Result of adding @Model.FirstNum and @Model.SecondNum is @Model.Result</p>
}
```

{% hint style="info" %}
What changes did you notice?
{% endhint %}
