public IActionResult Post(EmpresaCadastroModel model) { try { var empresaDTO = empresaApplicationService.Create(model); return(StatusCode(201, new { Message = "Empresa cadastrada com sucesso.", Empresa = empresaDTO })); } catch (Exception e) { return(StatusCode(500, new { e.Message }));; } }
public EmpresaDTO Create(EmpresaCadastroModel model) { var empresaEntity = new EmpresaEntity { Id = Guid.NewGuid(), RazaoSocial = model.RazaoSocial, NomeFantasia = model.NomeFantasia, Cnpj = model.Cnpj }; empresaDomainService.Create(empresaEntity); return(new EmpresaDTO { Id = empresaEntity.Id, RazaoSocial = empresaEntity.RazaoSocial, NomeFantasia = empresaEntity.NomeFantasia, Cnpj = empresaEntity.Cnpj }); }