25 lines
No EOL
675 B
C#
25 lines
No EOL
675 B
C#
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace isn.Data.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; }
|
|
|
|
public bool IsValid => CreationDate.AddDays(ValidityPeriodInDays) > DateTime.Now;
|
|
}
|
|
} |