dependencies
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using isn.abst;
|
||||
@ -8,6 +9,7 @@ using isnd.Entities;
|
||||
using isnd.Helpers;
|
||||
using isnd.ViewModels;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Web.Virtualization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
@ -20,12 +22,22 @@ namespace isnd.Controllers
|
||||
public async Task<IActionResult> Index(PackageRegistrationQuery model)
|
||||
{
|
||||
var pkgs = await packageManager.SearchPackageAsync(model);
|
||||
var result = new RegistrationPageIndexQueryAndResult
|
||||
{
|
||||
Source = packageManager.CatalogBaseUrl+ApiConfig.Index,
|
||||
Query = model
|
||||
};
|
||||
List<PackageRegistration> registrations = new List<PackageRegistration>();
|
||||
foreach (var pk in pkgs.data.GroupBy(x => x.PackageId))
|
||||
{
|
||||
registrations.Add(new PackageRegistration(apiBase, pk.Key, pkgs.GetResults().Single(p=>p.Id == pk.Key).Versions));
|
||||
}
|
||||
|
||||
return View(new RegistrationPageIndexQueryAndResult
|
||||
{
|
||||
Source = packageManager.CatalogBaseUrl+ApiConfig.Index,
|
||||
Query = model,
|
||||
Result = pkgs.GetResults().Select(p => new PackageRegistration(apiBase, p)).ToArray()
|
||||
Result = registrations.ToArray()
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user