mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-11 06:18:39 +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.Types.Entities.Notifications
|
||||
@using LBPUnion.ProjectLighthouse.Types.Entities.Website
|
||||
@using LBPUnion.ProjectLighthouse.Types.Notifications
|
||||
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.NotificationsPage
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
|
||||
@{
|
||||
Layout = "Layouts/BaseLayout";
|
||||
Model.Title = Model.Translate(GeneralStrings.Notifications);
|
||||
string timeZone = Model.GetTimeZone();
|
||||
TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(timeZone);
|
||||
}
|
||||
|
||||
@if (Model.User != null && Model.User.IsAdmin)
|
||||
|
@ -51,6 +52,7 @@
|
|||
<a style="color: black" href="~/user/@announcement.Publisher.UserId">
|
||||
@announcement.Publisher.Username
|
||||
</a>
|
||||
at @TimeZoneInfo.ConvertTime(announcement.PublishedAt, TimeZoneInfo.Utc, timeZoneInfo).ToString("M/d/yyyy h:mm:ss tt")
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
|
|
@ -54,6 +54,7 @@ public class NotificationsPage : BaseLayout
|
|||
Title = title.Trim(),
|
||||
Content = content.Trim(),
|
||||
PublisherId = user.UserId,
|
||||
PublishedAt = DateTime.UtcNow,
|
||||
};
|
||||
|
||||
this.Database.WebsiteAnnouncements.Add(announcement);
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace LBPUnion.ProjectLighthouse.Migrations
|
|||
table: "WebsiteAnnouncements",
|
||||
type: "datetime(6)",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
defaultValue: DateTime.UtcNow);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue