Пример #1
0
        public Task<HttpResponseMessage> Put(int id, [FromBody]dynamic body)
        {
            var command = new UpdateSetorCommand(
                          nomeSetor: (string)body.nomeSetor
                  );

            var setor = _service.Update(command, id);
            return CreateResponse(HttpStatusCode.OK, setor);
        }
        public Setor Update(UpdateSetorCommand command, int id)
        {
            var _setor = _repository.GetById(id);
            _setor.UpdateInfo(command.NomeSetor);
            _repository.Update(_setor);

            if (Commit())
                return _setor;

            return null;
        }