public PagedResponse <Archivo> BusquedaPaginada(ArchivoFiltro filtro) { var pr = new PagedResponse <Archivo> { Data = new List <Archivo>() }; //Filter string id = filtro.id ?? ""; var sort = new SortDefinitionBuilder <Datos.NoSQL.Modelo.Archivo>().Descending(x => x.fechaCreacion); var r = _archivoRepositorio.FindPaged(filtro, //x => (x.esBorrado == false && (x.id == (id.Length == 0 ? x.id : ObjectId.Parse(id)))), x => (x.esBorrado == false), sort); //To foreach (var item in r.Data) { pr.Data.Add(new Archivo { nombre = item.nombre, fechaCreacion = item.fechaCreacion, id = item.id.ToString(), versiones = GetVersiones(item.id.ToString()) }); } pr.TotalPages = r.TotalPages; pr.TotalRows = r.TotalRows; return(pr); }
public Archivo Archivo(ArchivoFiltro filtro) { filtro.Page = 1; filtro.PageSize = 1000; var files = BusquedaPaginada(filtro); return(files.Data.FirstOrDefault()); }