This commit is contained in:
Paul Schneider 2021-08-15 19:09:01 +01:00
commit 504f431937
67 changed files with 239 additions and 96 deletions

View file

@ -7,14 +7,14 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using isn.Data;
using isn.Data.Roles;
using isnd.Data;
using isnd.Data.Roles;
using System;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
namespace isn.Controllers
namespace isnd.Controllers
{
[AllowAnonymous]
public class AccountController : Controller

View file

@ -10,12 +10,12 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Options;
using isn.Data;
using isn.Entities;
using isn.Data.ApiKeys;
using isnd.Data;
using isnd.Entities;
using isnd.Data.ApiKeys;
namespace isn.Controllers
namespace isnd.Controllers
{
[Authorize]
public class ApiKeysController : Controller

View file

@ -2,10 +2,10 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using isn.Entities;
using isn.Data;
using isnd.Entities;
using isnd.Data;
using System.Linq;
using isn.ViewModels;
using isnd.ViewModels;
using Unleash.ClientFactory;
using Unleash;
using isnd.Entities;
@ -13,7 +13,7 @@ using System;
using System.Collections.Generic;
using isnd.Helpers;
namespace isn.Controllers
namespace isnd.Controllers
{
public class HomeController : Controller
{

View file

@ -1,9 +1,9 @@
using System;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using isn.Data;
using isnd.Data;
namespace isn.Controllers
namespace isnd.Controllers
{
public class NewUpdateController : Controller

View file

@ -4,10 +4,10 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using isn.Data;
using isn.ViewModels;
using isnd.Data;
using isnd.ViewModels;
namespace isn
namespace isnd
{
[AllowAnonymous]
public class PackageVersionController : Controller

View file

@ -11,11 +11,11 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using NuGet.Packaging.Core;
using NuGet.Versioning;
using isn.Data;
using isn.Helpers;
using isnd.Data;
using isnd.Helpers;
using Microsoft.AspNetCore.Http;
namespace isn.Controllers
namespace isnd.Controllers
{
public partial class PackagesController

View file

@ -8,8 +8,8 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using NuGet.Versioning;
using isn.Data;
using isn.Entities;
using isnd.Data;
using isnd.Entities;
using Unleash.ClientFactory;
using Unleash;
using System.Collections.Generic;
@ -17,8 +17,10 @@ using isnd.Services;
using isnd.Entities;
using Microsoft.AspNetCore.Hosting;
using isnd.Helpers;
using isnd.ViewModels;
using System.Threading.Tasks;
namespace isn.Controllers
namespace isnd.Controllers
{
[AllowAnonymous]
@ -60,6 +62,42 @@ namespace isn.Controllers
// GET {@id}?q={QUERY}&skip={SKIP}&take={TAKE}&prerelease={PRERELEASE}&semVerLevel={SEMVERLEVEL}&packageType={PACKAGETYPE}
// GET: PackageVersion
public async Task<IActionResult> Index(PackageIndexViewModel model)
{
var applicationDbContext = _dbContext.Packages.Include(p => p.Versions).Where(
p => ( model.Prerelease || p.Versions.Any(v => !v.IsPrerelease))
&& ((model.query == null) || p.Id.StartsWith(model.query)));
model.data = await applicationDbContext.ToArrayAsync();
return View(model);
}
// GET: PackageVersion/Details/5
public async Task<IActionResult> Details(string pkgid)
{
if (pkgid == null)
{
return NotFound();
}
var packageVersion = _dbContext.PackageVersions
.Include(p => p.Package)
.Where(m => m.PackageId == pkgid)
.OrderByDescending(p => p)
;
if (packageVersion == null)
{
return NotFound();
}
bool results = await packageVersion.AnyAsync();
var latest = await packageVersion.FirstAsync();
return View("Details", new PackageDetailViewModel { latest = latest, pkgid = pkgid, totalHits = packageVersion.Count(), data = packageVersion.Take(10).ToArray() } );
}
[HttpGet("~/index.json")]
public IActionResult ApiIndex()
{

View file

@ -1,4 +1,4 @@
namespace isn.Controllers
namespace isnd.Controllers
{
internal class Resource
{

View file

@ -2,7 +2,7 @@ using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace isn.Controllers
namespace isnd.Controllers
{
internal class SafeNameAttribute : ValidationAttribute
{