public void Update(UpdatePhoneCompanyCommand command)
        {
            if (!this.UpdatePhoneCompanyScopeIsValid(command))
            {
                return;
            }

            this.Number = command.Number;
        }
        public Task <HttpResponseMessage> Put(int id, [FromBody] dynamic body)
        {
            var command = new UpdatePhoneCompanyCommand(
                idPhoneCompany: id,
                number: (string)body.number
                );

            var phone = _service.Update(command);

            return(CreateResponse(HttpStatusCode.OK, phone));
        }
Exemplo n.º 3
0
        public PhoneCompany Update(UpdatePhoneCompanyCommand command)
        {
            var phone = _repository.GetById(command.IdPhoneCompany);

            phone.Update(command);
            _repository.Update(phone);

            if (Commit())
            {
                return(phone);
            }

            return(null);
        }
Exemplo n.º 4
0
 public static bool UpdatePhoneCompanyScopeIsValid(this PhoneCompany phoneCompany, UpdatePhoneCompanyCommand command)
 {
     return(AssertionConcern.IsSatisfiedBy
            (
                AssertionConcern.AssertNotEmpty(command.Number, "O Número é obrigatório")
            ));
 }