tentative campaign map management
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michele 2021-08-30 23:30:04 +01:00
parent c46e66595b
commit 4c345bd044
37 changed files with 1693 additions and 50 deletions

View file

@ -2,6 +2,7 @@ using MediatR;
using Sledgemapper.Api.Commands;
using Sledgemapper.Api.Infrastructure.Data;
using Sledgemapper.Api.Models;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@ -20,10 +21,14 @@ namespace Sledgemapper.Api.Handlers
public async Task<bool> Handle(NewSessionCommand notification, CancellationToken cancellationToken)
{
var campaign = _dbcontext.Campaigns.First(c => c.CampaignName == notification.Campaign && c.OwnerId == notification.UserId.ToString());
_dbcontext.Sessions.Add(new Session
{
SessionName = notification.SessionName,
OwnerUserId = notification.UserId
OwnerUserId = notification.UserId,
CampaignId = campaign.CampaignId
});
await _dbcontext.SaveChangesAsync();
return true;