Пример #1
0
        public async Task <IActionResult> PostAsync(CreatePortfolioRequest request, CancellationToken cancellationToken)
        {
            _logger.LogInformation("Portfolios/PostAsync was requested.");
            var response = await _portfolioService.CreateAsync(_mapper.Map <PortfolioDto>(request));

            return(Ok(_mapper.Map <PortfolioResponse>(response)));
        }
Пример #2
0
        public ActionResult CreatePortfolio([FromBody] Portfolio portfolio)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _portfolioService.CreateAsync(portfolio);
            return(Json(@portfolio));
        }