예제 #1
0
        public async Task <IEnumerable <OcIntranet> > GetTop(String server, int cantTop)
        {
            try
            {
                ModulosRepository modulos = new ModulosRepository(_db);
                var mods = await modulos.GetAll();

                List <OcIntranet> ocs = new List <OcIntranet>();
                foreach (var m in mods)
                {
                    var idModulo = m.ModuloId;
                    var result   = await _db.dbSetNuevoOC.AsNoTracking()
                                   .Where(x => x.ModuloId == idModulo)
                                   .Include(x => x.Ocs)
                                   .OrderByDescending(x => x.FechaRegistro)
                                   .Select(x => new OcIntranet
                    {
                        Fecha  = x.FechaRegistro,
                        TipoOC = x.Ocs.Nombre,
                        Nombre = x.descripcion,
                        Liga   = String.Concat(server, x.liga),
                    })
                                   .Take(cantTop)
                                   .ToListAsync();

                    ocs.AddRange(result);
                }
                return(ocs);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
        }
예제 #2
0
        public async Task <IEnumerable <NuevoOC> > getOCtopRaw(int cantTop)
        {
            try
            {
                ModulosRepository modulos = new ModulosRepository(_db);
                var mods = await modulos.GetAll();

                var result = await _db.dbSetNuevoOC
                             .Include(x => x.Ocs)
                             .OrderByDescending(x => x.FechaRegistro)
                             .Take(cantTop)
                             .ToListAsync();

                return(result);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
        }