public Ticket Update(Ticket ticket, int id)
        {
            var _ticket = _repository.GetId(id);
            _ticket.UpdateInfo(ticket.Assunto,ticket.Prioridade,ticket.IdEmpresa,ticket.Descricao,ticket.IdSituacao,ticket.IdSetor,ticket.IdUsuario,ticket.DataCdastro);
            _repository.Update(_ticket);

            if (Commit())
                return _ticket;

            return null;
        }
        public Ticket Register(Ticket ticket)
        {
            var _ticket = new Ticket(ticket.Assunto,ticket.Prioridade,ticket.IdEmpresa,ticket.Descricao,
                                     ticket.IdSituacao,ticket.IdSetor, ticket.IdUsuario,ticket.DataCdastro);

            _repository.Register(_ticket);

            if (Commit())
                return _ticket;

            return null;
        }
        public Task<HttpResponseMessage> Post([FromBody]dynamic body)
        {
            var command = new Ticket(
                assunto: (string)body.assunto,
                prioridade: (string)body.prioridade,
                idempresa: (int)body.idempresa,
                descricao: (string)body.descricao,
                idSituacao: (int)body.idSituacao,
                idSetor: (int)body.idSetor,
                idUsuario: (int)body.idUsuario,
                dataCadastro:(DateTime) DateTime.Now

            );
            var ticket = _service.Register(command);
            return CreateResponse(HttpStatusCode.Created, ticket);
        }
 public void Update(Ticket ticket)
 {
     _context.Entry<Ticket>(ticket).State = System.Data.Entity.EntityState.Modified;
 }
 public void Register(Ticket ticket)
 {
     _context.Ticket.Add(ticket);
 }