コード例 #1
0
ファイル: BalanceSheet.cs プロジェクト: dmmusil/Transacto
        public void Configure(IEndpointRouteBuilder builder) => builder
        .MapGet("{thru}", context => {
            var readModel = context.RequestServices.GetRequiredService <InMemoryProjectionDatabase>()
                            .Get <ReadModel>();

            if (!readModel.HasValue)
            {
                return(new ValueTask <Response>(HalResponse.Create <BalanceSheetReport>(context.Request,
                                                                                        new BalanceSheetReportRepresentation(),
                                                                                        Optional <Position> .Empty)));
            }

            var thru = Time.Parse.LocalDateTime(context.GetRouteValue("thru") !.ToString() !);
コード例 #2
0
        public void Configure(IEndpointRouteBuilder builder) => builder
        .MapGet(string.Empty, context => {
            var readModel = context.RequestServices.GetRequiredService <InMemoryProjectionDatabase>()
                            .Get <ReadModel>();

            return(new(HalResponse.Create(context.Request, new ChartOfAccountsRepresentation(),
                                          readModel.HasValue ? readModel.Value.Checkpoint : Optional <Position> .Empty,
                                          readModel)));
        })
        .MapCommands(string.Empty,
                     typeof(DefineAccount),
                     typeof(RenameAccount),
                     typeof(DeactivateAccount),
                     typeof(ReactivateAccount));