public EditTicketResponse Edit(EditTicketRequest request)
        {
            logger.Debug("About to validate an edit-ticket request");
            var validationResult = ValidateRequest(request);

            logger.Debug(validationResult);

            if (!validationResult.IsSuccess)
            {
                return(responseCreator.GetResponse(validationResult, null));
            }

            using (var trans = transactionFactory.GetTransaction())
            {
                if (logger.IsDebugEnabled)
                {
                    logger.Debug($"Transaction used is a {trans.GetType().FullName}");
                }

                var ticket = ticketRepo.Get(request.Identity);

                editor.Edit(ticket, request);
                ticketRepo.Update(ticket);
                trans.Commit();

                return(responseCreator.GetResponse(validationResult, ticket));
            }
        }
Beispiel #2
0
        public void Edit(Ticket ticket, EditTicketRequest request)
        {
            wrappedInstance.Edit(ticket, request);

            var labels = labelProvider.GetLabels(request.CommaSeparatedLabelNames);

            ticket.Labels.ReplaceContents(labels);
        }
        public void Edit(Ticket ticket, EditTicketRequest request)
        {
            wrappedInstance.Edit(ticket, request);

            var relationships = relationshipFactory.Convert(request.RelationshipsToAdd);

            ticket.PrimaryRelationships.UnionWith(relationships.Where(x => x.PrimaryTicket == null));
            ticket.SecondaryRelationships.UnionWith(relationships.Where(x => x.SecondaryTicket == null));
        }
        public void Edit(Ticket ticket, EditTicketRequest request)
        {
            wrappedInstance.Edit(ticket, request);

            RemoveRelationships(ticket.PrimaryRelationships,
                                request.RelationshipsToRemove.Select(x => x.TicketRelationshipId));

            RemoveRelationships(ticket.SecondaryRelationships,
                                request.RelationshipsToRemove.Select(x => x.TicketRelationshipId));
        }