示例#1
0
        public async Task <ActionResult> CreateItemAsync([FromBody] EmailDTO email, CancellationToken cancellationToken)
        {
            var newItem = _mapper.Map <Email>(email);

            newItem = await _emailService.AddAsync(newItem, cancellationToken);

            if (newItem == null)
            {
                AssignToModelState(_emailService.Errors);
                return(ValidationProblem());
            }

            return(CreatedAtAction(nameof(ItemByIdAsync), new { id = newItem.Id }, null));
        }