0
How to perform research with interval between one or two dates in Asp.Net Core 2.2.
I have the following form below containing Start Date and End Date
    @using (Html.BeginForm("Index", "OrdensChegadas", FormMethod.Get))
    {
        <div class="input-group">
            @Html.TextBox("DataInicio", "", new { @class = "form-control", type = "date" })
            @Html.TextBox("DataFinal", "", new { @class = "form-control", type = "date" })
            <span class="input-group-btn">
                <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
            </span>
        </div>
    } 
When I submit the form a Controller can receive the values of Start Date only or Start Date and End Date
In tests I performed only using Datainicio I’m not getting results, noting that I also tried with the condition below:
var applicationDbContext = _context.OrdensChegadas.Include(o => o.GetVeiculo).Where(e => e.Data.ToShortDateString().Equals(DataInicio)).OrderBy(o => o.Ordem);
And so too:
    public async Task<IActionResult> Index(DateTime? DataInicio, DateTime? DataFinal)
    {
        var applicationDbContext = _context.OrdensChegadas.Include(o => o.GetVeiculo).Where(e => e.Data == DataInicio).OrderBy(o => o.Ordem);
        return View(await applicationDbContext.ToListAsync());
    }