コード例 #1
0
        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;
        }
コード例 #2
0
        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;
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 public void Update(Ticket ticket)
 {
     _context.Entry<Ticket>(ticket).State = System.Data.Entity.EntityState.Modified;
 }
コード例 #5
0
 public void Register(Ticket ticket)
 {
     _context.Ticket.Add(ticket);
 }