示例#1
0
        public async Task <IActionResult> Produce(CreateProductionSiteRequest request)
        {
            var validatorActionResult = await _validationArrangement.Validate(request);

            var actionResult = await _operationArrangement.Process(request, validatorActionResult);

            return(actionResult);
        }
        public async Task <IActionResult> Create([FromQuery] CreateProductionSiteFromQuery query,
                                                 [FromBody] CreateProductionSiteFromBody body)
        {
            var request = new CreateProductionSiteRequest(query, body);

            var result = await _apiResult.Produce(request);

            return(result);
        }
        public async Task<IActionResult> Process(CreateProductionSiteRequest request, IValidatorActionResult validatorActionResult)
        {
            IActionResult actionResult;

            if (validatorActionResult.Result == null)
            {
                var call = _cqsMapper.Map(request);

                var result = await _mediator.Send(call);

                actionResult = result.IsFailure ? _apiResponse.Fail(result)
                                                : _apiResponse.Created(string.Format("/api/productionsites/{0}", ((Result<Guid>)result).Value), result.Version.ToString());
            }
            else
            {
                actionResult = validatorActionResult.Result;
            }

            return actionResult;
        }
示例#4
0
        public CreateProductionSiteCommand Map(CreateProductionSiteRequest request)
        {
            var result = new CreateProductionSiteCommand(request.BodyCode, request.BodyName, request.BodySource);

            return(result);
        }