public async Task <List <ConvocatoriasSIGPROY> > GetAllByFondoSIGPROY(int id) { try { List <ConvocatoriasSIGPROY> convS = new List <ConvocatoriasSIGPROY>(); ConvocatoriaRepository cv = new ConvocatoriaRepository(); var entities = await _db.Convocatoria .AsNoTracking() .Select(x => new ConvocatoriasSIGPROY { ConvocatoriaId = x.ConvocatoriaId, NombreConvocatoria = x.NombreConvocatoria, EstadoConvoc = x.Estado, FondoProgramaId = x.FondoProgramaId }) .Where(x => x.FondoProgramaId == id && x.EstadoConvoc == true) .ToListAsync(); convS.AddRange(entities); return(convS); } catch (Exception e) { throw new Exception(e.Message, e); } }
public async Task <List <FondosFinanciamientoSIGPROY> > GetAllByFuenteSIGPROY(int id) { try { List <FondosFinanciamientoSIGPROY> fondosS = new List <FondosFinanciamientoSIGPROY>(); ConvocatoriaRepository cv = new ConvocatoriaRepository(); var entities = await _db.FondoPrograma .AsNoTracking() .Select(x => new FondosFinanciamientoSIGPROY { FondoProgramaId = x.FondoProgramaId, NombreFP = x.NombreFP, EstadoFP = x.Estado, FuenteFinanciamientoId = x.FuenteFinanciamientoId }) .Where(x => x.FuenteFinanciamientoId == id && x.EstadoFP == true) .ToListAsync(); fondosS.AddRange(entities); foreach (FondosFinanciamientoSIGPROY fps in fondosS) { var fondoId = (int)fps.FondoProgramaId; fps.ConvocatoriasSIGPROY = await cv.GetAllByFondoSIGPROY(fondoId); } return(fondosS); } catch (Exception e) { throw new Exception(e.Message, e); } }