BotSharp/BotSharp.Core/Accounts/User.cs

61 lines
1.4 KiB
C#
Raw Normal View History

2018-08-02 21:14:46 +00:00
using EntityFrameworkCore.BootKit;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace BotSharp.Core.Accounts
{
/// <summary>
/// User profile
/// </summary>
[Table("User")]
public class User : DbRecord, IDbRecord
{
[Required]
[StringLength(64)]
2019-03-07 15:25:30 +00:00
public string UserName { get; set; }
2018-08-02 21:14:46 +00:00
[Required]
[StringLength(64)]
[DataType(DataType.EmailAddress)]
2019-03-07 15:25:30 +00:00
public string Email { get; set; }
2018-08-02 21:14:46 +00:00
[StringLength(32)]
2019-03-07 15:25:30 +00:00
public string FirstName { get; set; }
2018-08-02 21:14:46 +00:00
[StringLength(32)]
2019-03-07 15:25:30 +00:00
public string LastName { get; set; }
2018-08-02 21:14:46 +00:00
[MaxLength(256)]
2019-03-07 15:25:30 +00:00
public string Description { get; set; }
2018-08-02 21:14:46 +00:00
[Required]
[DataType(DataType.DateTime)]
public DateTime SignupDate { get; set; }
[DataType(DataType.Date)]
public DateTime? Birthday { get; set; }
[MaxLength(36)]
2019-03-07 15:25:30 +00:00
public string Nationality { get; set; }
2018-08-02 21:14:46 +00:00
[NotMapped]
2019-03-07 15:25:30 +00:00
public string FullName
2018-08-02 21:14:46 +00:00
{
get
{
2019-03-07 15:25:30 +00:00
return FirstName + (string.IsNullOrEmpty(LastName) ? "" : " " + LastName);
2018-08-02 21:14:46 +00:00
}
}
public UserAuth Authenticaiton { get; set; }
public User()
{
SignupDate = DateTime.UtcNow;
}
}
}