I need to show all day sales MVC C#

Asked

Viewed 29 times

-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 to ViewModel for the view?

  • I need to list the products by date. I am not able to make the connection passing this command(Viewmodel).

1 answer

0

Your method of searching for the bank’s launches should return a list of all the releases of that day, and not void as it is being done.

Once done, just return to View and passing as argument what was returned.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.