Exemplo n.º 1
0
        public int CrearTicket(RequestCreateTicket request, string currentDomain = "")
        {
            int RowsAfected = 0;
            var ticket      = new Ticket()
            {
                Descripcion = request.Description,
                IdTemplate  = request.IdTemplate
            };

            RowsAfected += DAO.AddTicket(ticket);
            RowsAfected += DAO.AddValoresTicket(request.Valores != null ? request.Valores
                                                .Select(v =>
            {
                return(new ValoresTicket()
                {
                    Clave = v.Key,
                    Valor = v.Value,
                    IdTicket = ticket.Id
                });
            }).ToArray() : new ValoresTicket[0]);
            if (!string.IsNullOrEmpty(currentDomain))
            {
                SendURL(request, string.Format("{0}/GetTicket/{1}", currentDomain, ticket.Id));
            }


            return(RowsAfected);
        }