public async Task <IHttpActionResult> AuftraegeAusleihen([FromBody] AuftraegeAusleihenParams p) { var access = ManagementControllerHelper.GetUserAccess(); if (!access.HasFeature(ApplicationFeature.AuftragsuebersichtAuftraegeKannAuftraegeAusleihen)) { return(StatusCode(HttpStatusCode.Forbidden)); } await orderManagerClient.AuftraegeAusleihen(ControllerHelper.GetCurrentUserId(), p.OrderItemIds); return(Content <object>(HttpStatusCode.NoContent, null)); }
public async Task Consume(ConsumeContext <AuftraegeAusleihenRequest> 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); } } await manager.AuftraegeAusleihen(context.Message.CurrentUserId, context.Message.OrderItemIds); await context.RespondAsync(new AuftraegeAusleihenResponse()); } }