コード例 #1
0
        public HttpResponseMessage EditCoworkerCompany(CompanyCoworkerDTO company)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    Claims claims = new Claims().Values();

                    var command = new UpdatePersonCompanyCommand()
                    {
                        PersonIntegrationId = company.CompanyId.Value,
                        FantasyName         = company.FantasyName,
                        FriendlyNameURL     = company.FriendlyNameURL,
                        Name            = company.ManagerName,
                        PersonalWebSite = company.PersonalWebSite,
                        PersonStatusId  = company.PersonStatusId,
                        PhoneNumber     = company.ManagerSmartPhoneNumber,
                        UpdatedBy       = claims.Values().userSystemId
                    };

                    bus.Send(command);
                }

                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            catch (System.Exception e)
            {
                LogManager.Error("Erro ao Add UserAdd", e);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e));
            }
        }
コード例 #2
0
        public async Task <HttpResponseMessage> EditCoWorkerComapny(PersonCoworkerUpdateDTO person)
        {
            try
            {
                if (person.PersonId == 0)
                {
                    var commandUpdatePersonCoWorker = new UpdatePersonCompanyCommand
                    {
                        Name            = person.Name,
                        FantasyName     = person.FantasyName,
                        FriendlyNameURL = person.FriendlyNameURL,
                        PersonTypeId    = person.PersonTypeId,
                        PersonProfileId = person.PersonProfileId,
                        PersonStatusId  = person.PersonStatusId,
                        PersonalWebSite = person.PersonalWebSite,
                        PhoneNumber     = person.PhoneNumber
                    };

                    bus.Send(commandUpdatePersonCoWorker);
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.PreconditionFailed, "invalid UserId"));
                }

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