예제 #1
0
        public async Task <HttpResponseMessage> AddCoworking(NewCompanyDTO coworking)
        {
            Guid   personIntegrationCode = Guid.NewGuid();
            Claims claims = new Claims().Values();

            try
            {
                var command = new AddPersonCoworkingCommand();

                if (ModelState.IsValid)
                {
                    command.IntegrationCode     = personIntegrationCode;
                    command.PersonIntegrationID = Guid.NewGuid();
                    command.CompanyName         = coworking.CompanyName;
                    command.CompanyPhoneNumber  = coworking.CompanyPhoneNumber;
                    command.ManagerName         = coworking.ManagerName;
                    command.ManagerPhoneNumber  = coworking.ManagerSmartPhoneNumber;
                    command.UserSystemId        = claims.userSystemId;
                    command.ManagerEmail        = coworking.ManagerEmail;
                    command.CreatedBy           = claims.userSystemId;
                    command.EnrollmentIP        = "Colocar aqui o IP";
                    command.PersonOriginType    = GeneralEnumerators.EnumPersonOriginType.IntegracaoAPIExterna;
                    this.bus.Send(command);
                }

                this.bus.Send(command);

                return(Request.CreateResponse(HttpStatusCode.OK, personIntegrationCode));
            }
            catch (System.Exception e)
            {
                LogManager.Error("Erro ao Add Coworking", e);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e));
            }
        }
예제 #2
0
        public async Task <HttpResponseMessage> AddAssociateCompanyUser(NewCompanyDTO company)
        {
            try
            {
                Claims claims = new Claims().Values();
                Guid   personIntegrationCode = Guid.NewGuid();
                var    commandCoWorking      = new AddPersonCoworkingCommand();

                commandCoWorking.IntegrationCode    = Guid.NewGuid();
                commandCoWorking.CompanyName        = company.CompanyName;
                commandCoWorking.CompanyPhoneNumber = company.CompanyPhoneNumber;
                commandCoWorking.ManagerName        = company.ManagerName;
                commandCoWorking.ManagerPhoneNumber = company.ManagerSmartPhoneNumber;
                commandCoWorking.UserSystemId       = claims.userSystemId;
                commandCoWorking.ManagerEmail       = company.ManagerEmail;
                commandCoWorking.CreatedBy          = claims.userSystemId;
                commandCoWorking.EnrollmentIP       = "Colocar aqui o IP";

                this.bus.Send(commandCoWorking);

                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            catch (System.Exception e)
            {
                LogManager.Error("Erro ao Add Coworking", e);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e));
            }
        }