Пример #1
0
 public Task <HandlerResult <OrderStatus> > Handle(ChangeStateOrderContext <TCommand, TFrom> input)
 {
     return(Handler
            .Handle(input)
            .AwaitAndPipeTo(x =>
                            x.Match(
                                result =>
     {
         input.Order.RemoveDomainEvents();
         return new HandlerResult <OrderStatus>(result.EligibleStatus);
     },
                                failure => failure)));
 }
Пример #2
0
        public async Task <HandlerResult <TTo> > Handle(ChangeStateOrderContext <TCommand, TFrom> input)
        {
            using var tr = _unitOfWork.BeginTransaction();
            try
            {
                await Task.Delay(300);

                var result = ChangeStateOrder(input);

                _unitOfWork.Commit();
                await tr.CommitAsync();

                return(result);
            }
            catch (Exception e)
            {
                await tr.RollbackAsync();

                return(FailureInfo.Invalid(e.Message));
            }
        }
Пример #3
0
 protected abstract TTo ChangeStateOrder(ChangeStateOrderContext <TCommand, TFrom> input);