public HttpResponseMessage AddCoworkerCompany(NewCompanyDTO company) { Claims claims = new Claims().Values(); Guid personIntegrationCode = Guid.NewGuid(); try { if (ModelState.IsValid) { var command = new AddPersonCompanyPartnerCommand(); command.IntegrationCode = Guid.NewGuid(); command.PersonIntegrationID = personIntegrationCode; command.CompanyName = company.CompanyName; command.CompanyPhoneNumber = company.CompanyPhoneNumber; command.ManagerName = company.ManagerName; command.ManagerPhoneNumber = company.ManagerSmartPhoneNumber; command.UserSystemId = claims.userSystemId; command.ManagerEmail = company.ManagerEmail; command.CreatedBy = claims.userSystemId; command.EnrollmentIP = HttpContext.Current.Request.UserHostAddress; command.PersonOriginType = GeneralEnumerators.EnumPersonOriginType.IntegracaoAPIExterna; command.SkinId = 3; command.PersonIntegrationFatherId = company.PersonIntegrationFatherId; this.bus.Send(command); } return(Request.CreateResponse(HttpStatusCode.OK, personIntegrationCode)); } catch (System.Exception e) { LogManager.Error("Erro ao Add Empresa Coworker", e); return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e)); } }
public HttpResponseMessage AddCompany(NewCompanyDTO company) { Claims claims = new Claims().Values(); Guid personIntegrationCode = Guid.NewGuid(); try { //se estao validos, cria o cammand var command = new AddPersonCompanyPartnerCommand(); if (ModelState.IsValid) { command.IntegrationCode = personIntegrationCode; command.PersonIntegrationID = Guid.NewGuid(); command.CompanyName = company.CompanyName; command.CompanyPhoneNumber = company.CompanyPhoneNumber; command.ManagerName = company.ManagerName; command.ManagerPhoneNumber = company.ManagerSmartPhoneNumber; command.UserSystemId = claims.userSystemId; command.ManagerEmail = company.ManagerEmail; command.CreatedBy = claims.userSystemId; command.EnrollmentIP = "Colocar aqui o IP"; command.PersonOriginType = GeneralEnumerators.EnumPersonOriginType.IntegracaoAPIExterna; this.bus.Send(command); } return(Request.CreateResponse(HttpStatusCode.OK, personIntegrationCode)); } catch (System.Exception e) { LogManager.Error("Erro ao Add UserAdd", e); return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e)); } }