rectoring
This commit is contained in:
parent
628fab2146
commit
1ae0ee5a8a
16 changed files with 135 additions and 62 deletions
32
Sledgemapper.Api/Handlers/StartNewSessionHandler.cs
Normal file
32
Sledgemapper.Api/Handlers/StartNewSessionHandler.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue