diff options
author | 杨宇千 <crupest@outlook.com> | 2019-10-21 20:47:31 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-10-21 20:47:31 +0800 |
commit | c442b7ad597f430b186dd8019de70332b574c4ba (patch) | |
tree | e6a9d4204e4fcd047cfcf5acd4ff566cf8bb69ff /Timeline/Models/UserDetail.cs | |
parent | 4c52f2d8b7aae43f391f54fb67fe91b8bc64e0c5 (diff) | |
download | timeline-c442b7ad597f430b186dd8019de70332b574c4ba.tar.gz timeline-c442b7ad597f430b186dd8019de70332b574c4ba.tar.bz2 timeline-c442b7ad597f430b186dd8019de70332b574c4ba.zip |
...
Diffstat (limited to 'Timeline/Models/UserDetail.cs')
-rw-r--r-- | Timeline/Models/UserDetail.cs | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/Timeline/Models/UserDetail.cs b/Timeline/Models/UserDetail.cs deleted file mode 100644 index 302e3bb1..00000000 --- a/Timeline/Models/UserDetail.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System.ComponentModel.DataAnnotations;
-using Timeline.Entities;
-using Timeline.Models.Validation;
-using Newtonsoft.Json;
-
-namespace Timeline.Models
-{
- public class UserDetail
- {
- [MaxLength(10)]
- public string? Nickname { get; set; }
-
- [ValidateWith(typeof(UserDetailValidators.QQValidator))]
- [JsonProperty(PropertyName = "qq")]
- public string? QQ { get; set; }
-
- [ValidateWith(typeof(UserDetailValidators.EMailValidator))]
- public string? Email { get; set; }
-
- [ValidateWith(typeof(UserDetailValidators.PhoneNumberValidator))]
- public string? PhoneNumber { get; set; }
-
- public string? Description { get; set; }
-
- private static string? CoerceEmptyToNull(string? value)
- {
- if (string.IsNullOrEmpty(value))
- return null;
- else
- return value;
- }
-
- public static UserDetail From(UserDetailEntity entity)
- {
- return new UserDetail
- {
- Nickname = CoerceEmptyToNull(entity.Nickname),
- QQ = CoerceEmptyToNull(entity.QQ),
- Email = CoerceEmptyToNull(entity.Email),
- PhoneNumber = CoerceEmptyToNull(entity.PhoneNumber),
- Description = CoerceEmptyToNull(entity.Description)
- };
- }
- }
-}
|