public async Task <IActionResult> CriarGarcom(GarcomDto dto) { var garcom = await _garcomService.Criar(dto); if (!IsValidOperation()) { return(BadRequest(GetValidations())); } UnitOfWork.Commit(); return(Ok(garcom)); }
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)); }