示例#1
0
        public void ChangePhone(ChangeCompanyPhoneCommand command)
        {
            command.Validate();

            if (AddNotifications(command))
            {
                return;
            }

            Company company = _repository.GetById(command.CompanyId);

            if (NotifyNullCompany(company) || NotifyDifferentUser(company))
            {
                return;
            }

            PhoneNumber phone = new PhoneNumber(command.PhoneNumber);

            company.ChangePhone(phone);

            if (AddNotifications(company))
            {
                return;
            }

            _repository.Update(company);

            Commit();
        }
示例#2
0
        public IActionResult ChangePhone(Guid id, [FromBody] ChangeCompanyPhoneCommand command)
        {
            command.CompanyId = id;

            _companyApplicationService.ChangePhone(command);

            return(CreateResponse());
        }
示例#3
0
        public void ShouldChangeCompanyPhone()
        {
            ChangeCompanyPhoneCommand command = new ChangeCompanyPhoneCommand
            {
                CompanyId   = new Guid("354f3d5b-52e9-4e71-917f-c1a6d977c5a1"),
                PhoneNumber = "37 1533333113"
            };

            Company company = service.GetById(new Guid("354f3d5b-52e9-4e71-917f-c1a6d977c5a1"));

            Assert.AreEqual(null, company.Address);

            service.ChangePhone(command);
            Assert.AreEqual("37 1533333113", company.Phone.Number);
        }