コード例 #1
0
        public Task <IResult <Unit> > Handle(StartMatch request, CancellationToken cancellationToken)
        {
            _provider.ExecuteCommand(db =>
            {
                var match = db.GetCollection <Append>().FindById(request.MatchId);
                if (match == null)
                {
                    throw new InvalidOperationException($"Append id {request.MatchId} does not exist.");
                }

                _queueWriter.Enqueue(new PerformAppend {
                    MatchId = request.MatchId
                }, cancellationToken);
                match.Status = AppendStatus.Queued;
                db.GetCollection <Append>().Update(match);
            });

            return(Task.FromResult <IResult <Unit> >(new SuccessResult()));
        }
コード例 #2
0
 private void UpdateAppend(Append append)
 {
     _uow.ExecuteCommand(db => db.GetCollection <Append>().Update(append));
 }