aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Models/UserDetail.cs
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-08-21 18:33:07 +0800
committer杨宇千 <crupest@outlook.com>2019-08-21 18:33:07 +0800
commitb3296b38176e26e410306bb19ef43da1523811b8 (patch)
tree72f5a8f65048f1495dddff7f12cedbd5eb4e39fc /Timeline/Models/UserDetail.cs
parenta585c6e35829e9f2b4b0b8ce8c6b395e5ea84f2c (diff)
downloadtimeline-b3296b38176e26e410306bb19ef43da1523811b8.tar.gz
timeline-b3296b38176e26e410306bb19ef43da1523811b8.tar.bz2
timeline-b3296b38176e26e410306bb19ef43da1523811b8.zip
Add database entity and service.
Diffstat (limited to 'Timeline/Models/UserDetail.cs')
-rw-r--r--Timeline/Models/UserDetail.cs31
1 files changed, 31 insertions, 0 deletions
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)
+ };
+ }
+ }
+}