From e5cf0da3976116cd575e884fb8f191f225fe9301 Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 4 Feb 2020 16:13:53 +0800 Subject: Add self link in entities. --- Timeline/Models/Http/UserInfo.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Timeline/Models/Http/UserInfo.cs') diff --git a/Timeline/Models/Http/UserInfo.cs b/Timeline/Models/Http/UserInfo.cs index 0d1d702b..68c6d8bd 100644 --- a/Timeline/Models/Http/UserInfo.cs +++ b/Timeline/Models/Http/UserInfo.cs @@ -19,6 +19,7 @@ namespace Timeline.Models.Http public class UserInfoLinks { + public string Self { get; set; } = default!; public string Avatar { get; set; } = default!; public string Timeline { get; set; } = default!; } @@ -42,6 +43,7 @@ namespace Timeline.Models.Http var urlHelper = _urlHelperFactory.GetUrlHelper(_actionContextAccessor.ActionContext); var result = new UserInfoLinks { + Self = urlHelper.ActionLink(nameof(UserController.Get), nameof(UserController)[0..^nameof(Controller).Length], new { destination.Username }), Avatar = urlHelper.ActionLink(nameof(UserAvatarController.Get), nameof(UserAvatarController)[0..^nameof(Controller).Length], new { destination.Username }), Timeline = urlHelper.ActionLink(nameof(PersonalTimelineController.TimelineGet), nameof(PersonalTimelineController)[0..^nameof(Controller).Length], new { destination.Username }) }; -- cgit v1.2.3