コード例 #1
0
        public async Task <IHttpActionResult> Zuruecksetzen([FromBody] ZuruecksetzenParams p)
        {
            var access = ManagementControllerHelper.GetUserAccess();

            AssertUserHasFeatureForOrderingType(p.OrderItemIds.ToArray(), access,
                                                ApplicationFeature.AuftragsuebersichtAuftraegeKannZuruecksetzen,
                                                ApplicationFeature.AuftragsuebersichtEinsichtsgesucheKannZuruecksetzen);

            await orderManagerClient.Zuruecksetzen(ControllerHelper.GetCurrentUserId(), p.OrderItemIds);

            return(Content <object>(HttpStatusCode.NoContent, null));
        }
コード例 #2
0
        public async Task Consume(ConsumeContext <ZuruecksetzenRequest> context)
        {
            using (LogContext.PushProperty(nameof(context.ConversationId), context.ConversationId))
            {
                Log.Information("Received {CommandName} command with conversationId {ConversationId} from the bus",
                                context.Message.GetType().Name, context.ConversationId);

                foreach (var id in context.Message.OrderItemIds)
                {
                    var item = await orderDataAccess.GetOrderItem(id);

                    if (item == null)
                    {
                        throw new Exception("Invalid OrderItem: " + id);
                    }
                }

                var m = context.Message;

                await manager.Zuruecksetzen(m.CurrentUserId, m.OrderItemIds);

                await context.RespondAsync(new ZuruecksetzenResponse());
            }
        }