mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-06 21:31:27 +00:00
* Simplify filters and make cross control slots not show by default Also sort author levels by oldest levels first rather than newest levels first. * Fix unit test expecting slots to sorted by timestamp descending * Remove errant whitespace
32 lines
No EOL
1,017 B
C#
32 lines
No EOL
1,017 B
C#
#nullable enable
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using LBPUnion.ProjectLighthouse.Database;
|
|
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
|
using LBPUnion.ProjectLighthouse.Types.Users;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace LBPUnion.ProjectLighthouse.Helpers;
|
|
|
|
public static class LastContactHelper
|
|
{
|
|
public static async Task SetLastContact(DatabaseContext database, UserEntity user, GameVersion gameVersion, Platform platform)
|
|
{
|
|
LastContactEntity? lastContact = await database.LastContacts.Where(l => l.UserId == user.UserId).FirstOrDefaultAsync();
|
|
|
|
if (lastContact == null)
|
|
{
|
|
lastContact = new LastContactEntity
|
|
{
|
|
UserId = user.UserId,
|
|
};
|
|
database.LastContacts.Add(lastContact);
|
|
}
|
|
|
|
lastContact.Timestamp = TimeHelper.Timestamp;
|
|
lastContact.GameVersion = gameVersion;
|
|
lastContact.Platform = platform;
|
|
|
|
await database.SaveChangesAsync();
|
|
}
|
|
} |