public static bool UpdatePhoneUserScopeIsValid(this PhoneUser phoneUser, UpdatePhoneUserCommand command) { return(AssertionConcern.IsSatisfiedBy ( AssertionConcern.AssertNotEmpty(command.Number, "O Número é obrigatório") )); }
public void Update(UpdatePhoneUserCommand command) { if (!this.UpdatePhoneUserScopeIsValid(command)) { return; } this.Number = command.Number; }
public Task <HttpResponseMessage> Put(int id, [FromBody] dynamic body) { var command = new UpdatePhoneUserCommand( idPhoneUser: id, number: (string)body.number ); var phone = _service.Update(command); return(CreateResponse(HttpStatusCode.OK, phone)); }
public PhoneUser Update(UpdatePhoneUserCommand command) { var phone = _repository.GetById(command.IdPhoneUser); phone.Update(command); _repository.Update(phone); if (Commit()) { return(phone); } return(null); }