Example #1
0
        public override async Task <ApplicationDraftDTO> CreateApplicationDraftFromBasketData(CreateApplicationDraftCommand createApplicationDraftCommand, ServerCallContext context)
        {
            _logger.LogInformation("Begin grpc call from method {Method} for applying get application draft {CreateApplicationDraftCommand}", context.Method, createApplicationDraftCommand);
            _logger.LogTrace(
                "----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
                createApplicationDraftCommand.GetGenericTypeName(),
                nameof(createApplicationDraftCommand.StudentId),
                createApplicationDraftCommand.StudentId,
                createApplicationDraftCommand);

            var command = new AppCommand.CreateApplicationDraftCommand(
                createApplicationDraftCommand.StudentId,
                this.MapBasketItems(createApplicationDraftCommand.Items));


            var data = await _mediator.Send(command);

            if (data != null)
            {
                context.Status = new Status(StatusCode.OK, $" applying get application draft {createApplicationDraftCommand} do exist");

                return(this.MapResponse(data));
            }
            else
            {
                context.Status = new Status(StatusCode.NotFound, $" applying get application draft {createApplicationDraftCommand} do not exist");
            }

            return(new ApplicationDraftDTO());
        }
        public async Task <ActionResult <ApplicationDraftDTO> > CreateApplicationDraftFromBasketDataAsync([FromBody] CreateApplicationDraftCommand createApplicationDraftCommand)
        {
            _logger.LogInformation(
                "----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
                createApplicationDraftCommand.GetGenericTypeName(),
                nameof(createApplicationDraftCommand.StudentId),
                createApplicationDraftCommand.StudentId,
                createApplicationDraftCommand);

            return(await _mediator.Send(createApplicationDraftCommand));
        }