From 62a3557ab62e1fa188e7498643d7cf0221a18322 Mon Sep 17 00:00:00 2001 From: 杨宇千 Date: Wed, 21 Aug 2019 18:33:07 +0800 Subject: Add database entity and service. --- Timeline/Models/UserDetail.cs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Timeline/Models/UserDetail.cs (limited to 'Timeline/Models/UserDetail.cs') diff --git a/Timeline/Models/UserDetail.cs b/Timeline/Models/UserDetail.cs new file mode 100644 index 00000000..91439c6a --- /dev/null +++ b/Timeline/Models/UserDetail.cs @@ -0,0 +1,31 @@ +using Timeline.Entities; + +namespace Timeline.Models +{ + public class UserDetail + { + public string QQ { get; set; } + public string EMail { get; set; } + 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 + { + QQ = CoerceEmptyToNull(entity.QQ), + EMail = CoerceEmptyToNull(entity.EMail), + PhoneNumber = CoerceEmptyToNull(entity.PhoneNumber), + Description = CoerceEmptyToNull(entity.Description) + }; + } + } +} -- cgit v1.2.3