public Task <HttpResponseMessage> Post([FromBody] dynamic body)
        {
            var command = new CreatePhoneCompanyCommand(
                number: (string)body.number,
                idCompany: (int)body.idCompany
                );

            var phone = _service.Create(command);

            return(CreateResponse(HttpStatusCode.Created, phone));
        }
Ejemplo n.º 2
0
        public PhoneCompany Create(CreatePhoneCompanyCommand command)
        {
            var phone = new PhoneCompany(command.Number, command.IdCompany);

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

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

            return(null);
        }