From 79ab2b304d93b1029515bd3f954db4e5a73f4168 Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 30 Jan 2020 20:26:52 +0800 Subject: ... --- Timeline/Services/User.cs | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) (limited to 'Timeline/Services/User.cs') diff --git a/Timeline/Services/User.cs b/Timeline/Services/User.cs index f63a374e..09a472e5 100644 --- a/Timeline/Services/User.cs +++ b/Timeline/Services/User.cs @@ -1,14 +1,9 @@ -using Microsoft.AspNetCore.Mvc; -using System; -using Timeline.Controllers; - -namespace Timeline.Services +namespace Timeline.Services { public class User { public string? Username { get; set; } public string? Nickname { get; set; } - public string? AvatarUrl { get; set; } #region adminsecret public bool? Administrator { get; set; } @@ -20,30 +15,4 @@ namespace Timeline.Services public long? Version { get; set; } #endregion secret } - - public static class UserExtensions - { - public static User EraseSecretAndFinalFill(this User user, IUrlHelper urlHelper, bool adminstrator) - { - if (user == null) - throw new ArgumentNullException(nameof(user)); - - var result = new User - { - Username = user.Username, - Nickname = user.Nickname, - AvatarUrl = urlHelper.ActionLink(action: nameof(UserAvatarController.Get), controller: nameof(UserAvatarController), values: new - { - user.Username - }) - }; - - if (adminstrator) - { - result.Administrator = user.Administrator; - } - - return result; - } - } } -- cgit v1.2.3