public async Task <IActionResult> Post([FromBody] GarcomViewModel garcomViewModel) { if (!ModelState.IsValid) { return(Response(garcomViewModel)); } var idCriado = await _garcomService.Criar(garcomViewModel); if (!IsValidOperation()) { return(Response(idCriado)); } _unitOfWork.Commit(); garcomViewModel.Id = idCriado; return(CreatedAtRoute(routeName: "GarcomGetById", routeValues: new { id = idCriado }, garcomViewModel)); }
public async Task <Guid> Criar(GarcomViewModel viewModel) { var registerCommand = _mapper.Map <CriarGarcomCommand>(viewModel); return(await _mediator.Send(registerCommand)); }