34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
// using MediatR;
|
|
// using Sledgemapper.Api.Data;
|
|
// using Sledgemapper.Shared.Entities;
|
|
// using System.Linq;
|
|
// using System.Text.Json;
|
|
// using System.Threading;
|
|
// using System.Threading.Tasks;
|
|
|
|
// namespace Sledgemapper.Api.Handlers
|
|
// {
|
|
// public class SaveNewTile : INotificationHandler<NewTileNotification>
|
|
// {
|
|
// private readonly MyDbContext _dbcontext;
|
|
|
|
// public SaveNewTile(MyDbContext dbcontext) => _dbcontext = dbcontext;
|
|
|
|
// public async Task Handle(NewTileNotification notification, CancellationToken cancellationToken)
|
|
// {
|
|
// var jsonString = JsonSerializer.Serialize<Tile>(notification.Tile);
|
|
// var session = _dbcontext.Sessions.First(m=>m.SessionName== notification.SessionName);
|
|
|
|
// _dbcontext.MapLogs.Add(new Sledgemapper.Api.Models.MapLog
|
|
// {
|
|
// Operation = "N",
|
|
// SessionId = session.SessionId,
|
|
// Type = "T",
|
|
// Timestamp = notification.Timestamp,
|
|
// Object = jsonString,
|
|
// UserId=notification.UserId
|
|
// });
|
|
// await _dbcontext.SaveChangesAsync();
|
|
// }
|
|
// }
|
|
// }
|