ApiKey
This commit is contained in:
parent
749eb645d5
commit
dd6d83cf06
28 changed files with 1097 additions and 184 deletions
23
Models/ApiKeys/ApiKey.cs
Normal file
23
Models/ApiKeys/ApiKey.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
14
Models/ApiKeys/ApiKeyViewModel.cs
Normal file
14
Models/ApiKeys/ApiKeyViewModel.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
14
Models/ApiKeys/CreateModel.cs
Normal file
14
Models/ApiKeys/CreateModel.cs
Normal 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; }
|
||||
|
||||
}
|
||||
}
|
||||
7
Models/ApiKeys/DeleteModel.cs
Normal file
7
Models/ApiKeys/DeleteModel.cs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
namespace nuget_host.Models.ApiKeys
|
||||
{
|
||||
public class DeleteModel
|
||||
{
|
||||
public ApiKey ApiKey { get; set; }
|
||||
}
|
||||
}
|
||||
8
Models/ApiKeys/DetailModel.cs
Normal file
8
Models/ApiKeys/DetailModel.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
namespace nuget_host.Models.ApiKeys
|
||||
{
|
||||
public class DetailModel : ApiKeyViewModel
|
||||
{
|
||||
public ApiKey ApiKey { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
12
Models/ApiKeys/EditModel.cs
Normal file
12
Models/ApiKeys/EditModel.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
9
Models/ApiKeys/IndexModel.cs
Normal file
9
Models/ApiKeys/IndexModel.cs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace nuget_host.Models.ApiKeys
|
||||
{
|
||||
public class IndexModel
|
||||
{
|
||||
public List<ApiKey> ApiKey { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue