I'm new to C #, I'm doing a web application in VisualStudio 2015, with ASP.NET MVC5 and EF6.
I need to compare the values that a linq query throws at me, normally I would do it with a two for
, one within the other, although maybe they can suggest a more optimal way to do it. My problem is that when I do the for
I have no way to get the value I need to compare.
Controller
var query_y_axis = db.registro.Select(o => new { o.value, o.date});
var minutes = 0;
for(var i = 0; i < query_y_axis .LongCount()-1; i++)
{
minutes = db.registro. //AQUI NO OBTENGO EL CAMPO POR EL QUE DESEO COMPARAR QUE ES DATE
}
My intention is to obtain the date field ( date ), and in minutes
store the minute of that date, and go comparing with the other data of that same query. and In the end get only the values that are in the same minute.
For example, if I get a list
2018-02-13 10: 04: 01,2018-02-13 10:04:02, 2018-02-13 10:04:50, 2018-02-13 10:04:59, 2018-02-13 10:05:06, 2018-02-13 10:05:17, 2018-02-13 10:05:23
of this list would be comparing the first with the others and I would be later another list with the first 4 values that are those that have the same minute as the initial date
(2018-02-13 10:04:01, 2018-02-13 10:04:02, 2018-02-13 10:04:50, 2018-02-13 10:04:59)
Thanks in advance.