mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-08 04:48:44 +00:00
Add timestamp to comments
This commit is contained in:
parent
14730f754b
commit
73ad687874
2 changed files with 11 additions and 0 deletions
|
@ -3,6 +3,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Serialization;
|
||||
using LBPUnion.ProjectLighthouse.Types;
|
||||
using LBPUnion.ProjectLighthouse.Types.Profiles;
|
||||
|
@ -50,6 +51,8 @@ namespace LBPUnion.ProjectLighthouse.Controllers {
|
|||
comment.PosterUserId = poster.UserId;
|
||||
comment.TargetUserId = target.UserId;
|
||||
|
||||
comment.Timestamp = TimeHelper.UnixTimeMilliseconds();
|
||||
|
||||
this.database.Comments.Add(comment);
|
||||
await this.database.SaveChangesAsync();
|
||||
return this.Ok();
|
||||
|
|
8
ProjectLighthouse/Helpers/TimeHelper.cs
Normal file
8
ProjectLighthouse/Helpers/TimeHelper.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
using System;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Helpers {
|
||||
public static class TimeHelper {
|
||||
public static long UnixTimeMilliseconds() => DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
||||
public static long UnixTimeSeconds() => DateTimeOffset.Now.ToUnixTimeSeconds();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue