Collect View data for the controler

1

I would like to know how I can collect a View data, and I'm already using @model System.data.dataset.

@model System.Data.DataSet
@{
   ViewBag.Title = "CadastroPorto";
}

I need to collect the data that will be typed in this part below when I click the button:

<section class="content-header">
   <div class="breadcrumb">
   <button type="button" class="btn btn-primary">Cadastrar novo Porto</button>
</div>
<div class="box-body">
        <div class="form-group">
            <label>Nome do Porto</label>
        </div>
</div>
</section>
    
asked by anonymous 02.07.2017 / 23:20

1 answer

2

There's a lot of weird stuff in the code that showed. A% typed% must be of the type of an entity of its own. In its example, it should be of type View .

@model 'Porto'    
<label>Nome do Porto:</label> @Html.InputFor(porto => porto.NomeDoPorto);

And in Porto you will receive the new port:

[POST][Route("/api/porto")]
public HttpResponseMessage AddPorto (Porto porto)
{
    dbContext.Portos.Add(porto);
    dbContext.SaveChanges();
}
    
03.07.2017 / 15:17