-2
Through an input the user enters the date and so list all the respective products of that day
public void Buscar(Lancamento lancamento)
{
string sql = string.Format("SELECT DataHora FROM Lancamento",lancamento.DataHora);
ExecuteCommand(sql);
}
[HttpPost]
public ActionResult Buscar(DateTime DataHora)
{
return View("IndexLancamento");
}
<form action="@Url.Action("Buscar", "Lancamento")" method="post">
<input type="text" value="@Model.Buscar" placeholder="Buscar por Data" />
<button type="submit" class="btn btn-success">Buscar</button>
</form>
<table>
<tr>
<td>Data</td>
</tr>
@{foreach (var item in Model)
{
<tr>
<td>@item.DataHora</td>
</tr>
}
}
</table>
And what is your question? Where is the
Action
passing toViewModel
for the view?– Leandro Angelo
I need to list the products by date. I am not able to make the connection passing this command(Viewmodel).
– Lorraine