search view fixed

This commit is contained in:
Paul Schneider 2022-10-17 19:17:04 +01:00
commit 95600facf4
10 changed files with 45 additions and 67 deletions

View file

@ -27,7 +27,7 @@ namespace isnd.Controllers
[HttpGet(_pkgRootPrefix + "{apiVersion}/" + ApiConfig.Registration + "/{id}/{lower}.json")]
public IActionResult CatalogRegistration(string apiVersion, string id, string lower)
{
if (lower.Equals("index", System.StringComparison.OrdinalIgnoreCase))
if (lower.Equals("index", System.StringComparison.InvariantCultureIgnoreCase))
{
var query = new Data.Catalog.RegistrationPageIndexQuery
{
@ -39,8 +39,8 @@ namespace isnd.Controllers
// query.TotalHits = result.Items.Select(i=>i.Items.Length).Aggregate((a,b)=>a+b);
return Ok(index);
}
var leaf = packageManager.SearchById(id,lower,null);
if (leaf.Count()==0) return NotFound(new { id, lower });
var leaf = packageManager.SearchById(id, lower, null);
if (leaf.Count() == 0) return NotFound(new { id, lower });
return Ok(leaf.First());
}

View file

@ -18,7 +18,7 @@ namespace isnd.Controllers
public async Task<IActionResult> Index(RegistrationPageIndexQuery model)
{
return View(new RegistrationPageIndexQueryAndResult{Query = model,
Result = packageManager.GetPackageRegistrationIndex(model)});
Result = packageManager.SearchPackage(model)});
}
public async Task<IActionResult> Details(string pkgid)
@ -34,7 +34,7 @@ namespace isnd.Controllers
.OrderByDescending(p => p)
;
if (packageVersion == null)
if (packageVersion.Count() == 0)
{
return NotFound();
}