This commit is contained in:
Paul Schneider 2021-05-02 16:37:03 +01:00
commit dd6d83cf06
28 changed files with 1097 additions and 184 deletions

23
Models/ApiKeys/ApiKey.cs Normal file
View file

@ -0,0 +1,23 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace nuget_host.Models.ApiKeys
{
public class ApiKey
{
[Required][Key][DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string Id { get; set; }
[Required][ForeignKey("User")]
public string UserId { get; set; }
public virtual ApplicationUser User { get; set; }
public string Name { get; set; }
public int ValidityPeriodInDays{ get; set; }
public DateTime CreationDate { get; set; }
}
}

View file

@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations;
namespace nuget_host.Models.ApiKeys
{
public class ApiKeyViewModel
{
[Display(Name = "Key Name")]
public string Name { get; set; }
[Display(Name = "Key Value")]
public string ProtectedValue { get; set; }
}
}

View file

@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations;
namespace nuget_host.Models.ApiKeys
{
public class CreateModel
{
[Required][StringLength(255)]
[Display(Name = "Key Name")]
public string Name { get; set; }
public string UserId { get; set; }
}
}

View file

@ -0,0 +1,7 @@
namespace nuget_host.Models.ApiKeys
{
public class DeleteModel
{
public ApiKey ApiKey { get; set; }
}
}

View file

@ -0,0 +1,8 @@
namespace nuget_host.Models.ApiKeys
{
public class DetailModel : ApiKeyViewModel
{
public ApiKey ApiKey { get; set; }
}
}

View file

@ -0,0 +1,12 @@
namespace nuget_host.Models.ApiKeys
{
public class EditModel
{
public EditModel()
{
if (ApiKey==null) ApiKey = new ApiKey();
}
public ApiKey ApiKey { get; set; }
}
}

View file

@ -0,0 +1,9 @@
using System.Collections.Generic;
namespace nuget_host.Models.ApiKeys
{
public class IndexModel
{
public List<ApiKey> ApiKey { get; set; }
}
}