aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Models/Http/UserInfo.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-03-10 03:04:23 +0800
committercrupest <crupest@outlook.com>2020-03-10 03:04:23 +0800
commit84079146cf4c179cfe2770386dcd9f1cd1e7b14a (patch)
tree17d64590d81fc02a2b8e3df88963288b0ca85bb7 /Timeline/Models/Http/UserInfo.cs
parentc3c9618c8493349fb3d6464d69359f7be6e8ce24 (diff)
downloadtimeline-84079146cf4c179cfe2770386dcd9f1cd1e7b14a.tar.gz
timeline-84079146cf4c179cfe2770386dcd9f1cd1e7b14a.tar.bz2
timeline-84079146cf4c179cfe2770386dcd9f1cd1e7b14a.zip
...
Diffstat (limited to 'Timeline/Models/Http/UserInfo.cs')
-rw-r--r--Timeline/Models/Http/UserInfo.cs18
1 files changed, 9 insertions, 9 deletions
diff --git a/Timeline/Models/Http/UserInfo.cs b/Timeline/Models/Http/UserInfo.cs
index 68c6d8bd..fcbbe7c9 100644
--- a/Timeline/Models/Http/UserInfo.cs
+++ b/Timeline/Models/Http/UserInfo.cs
@@ -2,19 +2,19 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Routing;
-using Timeline.Controllers;
-using Timeline.Services;
+using System;
+using TimelineApp.Controllers;
-namespace Timeline.Models.Http
+namespace TimelineApp.Models.Http
{
public class UserInfo
{
public string Username { get; set; } = default!;
public string Nickname { get; set; } = default!;
public bool? Administrator { get; set; } = default!;
-#pragma warning disable CA1707
- public UserInfoLinks? _links { get; set; }
-#pragma warning restore CA1707
+#pragma warning disable CA1707 // Identifiers should not contain underscores
+ public UserInfoLinks _links { get; set; } = default!;
+#pragma warning restore CA1707 // Identifiers should not contain underscores
}
public class UserInfoLinks
@@ -24,7 +24,7 @@ namespace Timeline.Models.Http
public string Timeline { get; set; } = default!;
}
- public class UserInfoLinksValueResolver : IValueResolver<User, UserInfo, UserInfoLinks?>
+ public class UserInfoLinksValueResolver : IValueResolver<User, UserInfo, UserInfoLinks>
{
private readonly IActionContextAccessor _actionContextAccessor;
private readonly IUrlHelperFactory _urlHelperFactory;
@@ -35,10 +35,10 @@ namespace Timeline.Models.Http
_urlHelperFactory = urlHelperFactory;
}
- public UserInfoLinks? Resolve(User source, UserInfo destination, UserInfoLinks? destMember, ResolutionContext context)
+ public UserInfoLinks Resolve(User source, UserInfo destination, UserInfoLinks destMember, ResolutionContext context)
{
if (_actionContextAccessor.ActionContext == null)
- return null;
+ throw new InvalidOperationException("No action context, can't fill urls.");
var urlHelper = _urlHelperFactory.GetUrlHelper(_actionContextAccessor.ActionContext);
var result = new UserInfoLinks