Exemplo n.º 1
0
        public async Task <IActionResult> Post([FromBody] DetailViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            viewModel.Id = await _detailService.CreateAsync(viewModel.ToDto(), Bll.Extensions.DetailExtensions.ToEntity);

            return(CreatedAtAction(nameof(Get), viewModel));
        }
 public async Task <Detail> Create(DetailModel detail)
 {
     return(await detailService.CreateAsync(detail));
 }