mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-11 14:28:40 +00:00
Set published at for announcements and set default value
This commit is contained in:
parent
94fe2d4d99
commit
05145ea7cb
3 changed files with 5 additions and 2 deletions
|
@ -2,13 +2,14 @@
|
||||||
@using LBPUnion.ProjectLighthouse.Localization.StringLists
|
@using LBPUnion.ProjectLighthouse.Localization.StringLists
|
||||||
@using LBPUnion.ProjectLighthouse.Types.Entities.Notifications
|
@using LBPUnion.ProjectLighthouse.Types.Entities.Notifications
|
||||||
@using LBPUnion.ProjectLighthouse.Types.Entities.Website
|
@using LBPUnion.ProjectLighthouse.Types.Entities.Website
|
||||||
@using LBPUnion.ProjectLighthouse.Types.Notifications
|
|
||||||
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.NotificationsPage
|
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.NotificationsPage
|
||||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
|
|
||||||
@{
|
@{
|
||||||
Layout = "Layouts/BaseLayout";
|
Layout = "Layouts/BaseLayout";
|
||||||
Model.Title = Model.Translate(GeneralStrings.Notifications);
|
Model.Title = Model.Translate(GeneralStrings.Notifications);
|
||||||
|
string timeZone = Model.GetTimeZone();
|
||||||
|
TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(timeZone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (Model.User != null && Model.User.IsAdmin)
|
@if (Model.User != null && Model.User.IsAdmin)
|
||||||
|
@ -51,6 +52,7 @@
|
||||||
<a style="color: black" href="~/user/@announcement.Publisher.UserId">
|
<a style="color: black" href="~/user/@announcement.Publisher.UserId">
|
||||||
@announcement.Publisher.Username
|
@announcement.Publisher.Username
|
||||||
</a>
|
</a>
|
||||||
|
at @TimeZoneInfo.ConvertTime(announcement.PublishedAt, TimeZoneInfo.Utc, timeZoneInfo).ToString("M/d/yyyy h:mm:ss tt")
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -54,6 +54,7 @@ public class NotificationsPage : BaseLayout
|
||||||
Title = title.Trim(),
|
Title = title.Trim(),
|
||||||
Content = content.Trim(),
|
Content = content.Trim(),
|
||||||
PublisherId = user.UserId,
|
PublisherId = user.UserId,
|
||||||
|
PublishedAt = DateTime.UtcNow,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.Database.WebsiteAnnouncements.Add(announcement);
|
this.Database.WebsiteAnnouncements.Add(announcement);
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace LBPUnion.ProjectLighthouse.Migrations
|
||||||
table: "WebsiteAnnouncements",
|
table: "WebsiteAnnouncements",
|
||||||
type: "datetime(6)",
|
type: "datetime(6)",
|
||||||
nullable: false,
|
nullable: false,
|
||||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
defaultValue: DateTime.UtcNow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue