VB.NET MVC Get vs Post how do i design my page
<p>I have a VB.NET mvc view form that has 3 parameters and 2 buttons and I not sure how to design my page.</p>

<p>Button 1 is essentially a GET - suppose to run a sql query and return a dataset (multiple tables).
Button 2 is essentially a PUT - suppose to run a sql update statement (multiple updates).</p>

<p>CustomModel includes my 3 parameters as Properties and I have included the Required Attribute on all.</p>

<p>How do I design so that the Required attributes are respected.
I.e. my ViewInfo method is being reached even if the parameter inputs are blank.</p>

<p>Do I declare ViewInfo with the HttpGet and my UpdateInfo with HttpPut attribute. Do I need the parameter declarations in my ViewInfo method?
Is my @Html.BeginForm(...) declaration correct?</p>

<p>VB.NET Model class:</p>

<pre><code>Public Class CustomModel
    &lt;Required(ErrorMessage:="Parameter 1 is required"),
    Display(Name:="Parameter 1:")&gt;
    Public Property Parameter1 As String

    &lt;Required(ErrorMessage:="Parameter 2 is required"),
    Display(Name:="Parameter 2:")&gt;
    Public Property Parameter2 As String

    &lt;Required(ErrorMessage:="Parameter 3 is required"),
    Display(Name:="Parameter 3:")&gt;
    Public Property Parameter3 As Integer

    Public Sub New(Parameter1 As String, Parameter2 As String, Parameter3 As Integer)
        Me.Parameter1 = Parameter1
        Me.Parameter2 = Parameter2
        Me.Parameter3 = Parameter3
    End Sub

    Public Property Info As DataSet = New DataSet
End Class
</code></pre>

<p>VB.NET Controller:</p>

<pre><code>Function Index() As ActionResult
    ViewBag.ShowView = False
    Return View()
End Function

Function ViewInfo(Parameter1 As String, Parameter2 As String, Parameter3 As Integer)
    Dim result As New CustomModel(Parameter1, Parameter2, Parameter3)
    If ModelState.IsValid Then
        result.Info = GetInfo(Parameter1, Parameter2, Parameter3)
    End If
    ViewBag.ShowView = True
    Return View("Index", result)
End Function

Function UpdateInfo(Parameter1 As String, Parameter2 As String, Parameter3 As Integer)
    Dim result As New CustomModel(Parameter1, Parameter2, Parameter3)
    If ModelState.IsValid Then
        result.Info = UpdateInfo(Parameter1, Parameter2, Parameter3)
    End If
    ViewBag.ShowView = True
    Return View("Index", result)
End Function
</code></pre>

<p>HTML View</p>

<pre><code>@ModelType CustomModel
...
@Using (Html.BeginForm("ViewInfo", "Home", Nothing, FormMethod.Post))
    ...
    @Html.LabelFor(...)
    @Html.TextBoxFor(...)
    ...
    &lt;button type=button&gt;View&lt;/button&gt;
    &lt;button type=submit&gt;Update&lt;/button&gt;
End Using
</code></pre>

<p>Output:</p>

<pre><code>@If ViewBag.Show Then
    // Multiple WebGrid calls ???
End If
</code></pre>