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

            AssertUserHasFeatureForOrderingType(p.OrderItemIds.ToArray(), access,
                                                ApplicationFeature.AuftragsuebersichtAuftraegeKannAbbrechen,
                                                ApplicationFeature.AuftragsuebersichtEinsichtsgesucheKannAbbrechen);

            await orderManagerClient.Abbrechen(ControllerHelper.GetCurrentUserId(), p.OrderItemIds, p.Abbruchgrund, p.BemerkungZumDossier,
                                               p.InterneBemerkung);

            return(Content <object>(HttpStatusCode.NoContent, null));
        }
        public async Task Consume(ConsumeContext <AbbrechenRequest> 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 = orderDataAccess.GetOrderItem(id);
                    if (item == null)
                    {
                        throw new Exception("Invalid OrderItem: " + id);
                    }
                }

                var m = context.Message;

                await manager.Abbrechen(m.CurrentUserId, m.OrderItemIds, m.Abbruchgrund, m.BemerkungZumDossier, m.InterneBemerkung);

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