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 { private readonly IMediator _mediator; private readonly MyDbContext _dbcontext; public StartNewSessionHandler(IMediator mediator, MyDbContext dbcontext) { _mediator = mediator; _dbcontext = dbcontext; } public async Task Handle(NewSessionCommand notification, CancellationToken cancellationToken) { // _dbcontext.MapLogs.Add(new Session // { // SessionName = notification.SessionName, // OwnerUserId = notification.UserId // }); await _dbcontext.SaveChangesAsync(); return true; } } }