Esempio n. 1
0
        public Task <HttpResponseMessage> Post([FromBody] dynamic body)
        {
            var command = new CreatePhoneUserCommand(
                number: (string)body.number,
                idUser: (int)body.idUser
                );

            var phone = _service.Create(command);

            return(CreateResponse(HttpStatusCode.Created, phone));
        }
        public PhoneUser Create(CreatePhoneUserCommand command)
        {
            var phone = new PhoneUser(command.Number, command.IdUser);

            phone.Create();
            _repository.Create(phone);

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

            return(null);
        }