c# - Problems with AnonymousType ASP.NET MVC -
i error , don't know how fix it, code:
var respaldos = db.respaldoes.where(x => x.type == "backup"); if (con_filtro_fecha) respaldos = respaldos.where(x => x.start_time >= _desde && x.start_time <= _hasta); if (con_agrupacion) { switch (agrupar) { case "dia": respaldos = respaldos.groupby(x => new{ x.start_time.year, x.start_time.month, x.start_time.day }) .select(x => new{ anio = x.key.year, mes = x.key.month, dia = x.key.day, bytes = x.sum(y => y.bytes_processed) }).asenumerable(); break; case "mes": respaldos = respaldos.groupby(x => new{ x.start_time.year, x.start_time.month }) .select(x => new{ anio = x.key.year, mes = x.key.month, bytes = x.sum(y => y.bytes_processed) }).asenumerable(); break; } }
how fix error in "asenumerable()"? or if not possible, can do?
error:
no se puede convertir implícitamente el tipo system.collections.generic.ienumerable anonymoustype#1 en system.linq.iqueryable respaldoservidores.models.respaldo . ya existe una conversión explícita (compruebe si le falta una conversión)
when call asenumerable
have 2 problems.
firstly, respaldos
iqueryable<t>
, can't assign enumerable<t>
it.
secondly, element types different. i'm not sure type of element respaldos
contains, won't same anonymous type query.
Comments
Post a Comment