rectoring

This commit is contained in:
Michele Scandura 2020-11-13 21:38:36 +00:00
parent 628fab2146
commit 1ae0ee5a8a
16 changed files with 135 additions and 62 deletions

View file

@ -0,0 +1,32 @@
using MediatR;
using Sledgemapper.Api.Commands;
using Sledgemapper.Api.Data;
using Sledgemapper.Api.Models;
using System.Threading;
using System.Threading.Tasks;
namespace Sledgemapper.Api.Handlers
{
public class StartNewSessionHandler : IRequestHandler<NewSessionCommand, bool>
{
private readonly IMediator _mediator;
private readonly MyDbContext _dbcontext;
public StartNewSessionHandler(IMediator mediator, MyDbContext dbcontext)
{
_mediator = mediator;
_dbcontext = dbcontext;
}
public async Task<bool> Handle(NewSessionCommand notification, CancellationToken cancellationToken)
{
// _dbcontext.MapLogs.Add(new Session
// {
// SessionName = notification.SessionName,
// OwnerUserId = notification.UserId
// });
await _dbcontext.SaveChangesAsync();
return true;
}
}
}