Esempio n. 1
0
        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));
            }
        }
Esempio n. 2
0
        IValidationResult ValidateRequest(EditTicketRequest request)
        {
            var validator = validatorFactory.GetValidator();

            return(validator.Validate(request));
        }