-1
Good morning, I made a query that returns only completed data between a given period, I only need these two data but entityframework is demanding some fields that I do not need as ID. Is there any way to ignore this data and only return to my query?
Code:
try
{
var year = DateTime.Now.ToString("yyyy");
var dataInicial = year + "-01-01";
var dataFinal = year + "-12-31";
string sql = "";
sql += " SELECT distinct Concluido Concluidos, count(Concluido) Total" +
" WHERE DataInicio BETWEEN " + "'" + dataInicial + "' AND " + "'" + dataFinal + "' group by concluido;";
var p = await context.Projetos
.FromSqlRaw(sql)
.AsNoTracking()
.ToListAsync();
return Ok(p);
}
catch (System.Exception ex)
{
return this.StatusCode(StatusCodes.Status500InternalServerError, "Falha: " + ex.ToString());
}
None of the fields returns in the query exists in the table, wanted to return the same data as the query: