Exemplo n.º 1
0
        public CreateSprintResponse Create(CreateSprintRequest request)
        {
            var validationResult = ValidateRequest(request);
            var response         = responseFactory.GetResponse(validationResult);

            if (!validationResult.IsSuccess)
            {
                return(response);
            }

            Sprint sprint;

            using (var trans = transactionFactory.GetTransaction())
            {
                var project = projectGetter.GetCurrentProject();
                if (project == null)
                {
                    response.ProjectDoesNotExist = true;
                    return(response);
                }

                sprint = CreateSprint(request, project);
                sprintRepo.Add(sprint);
                trans.Commit();

                response.Sprint = sprint;
            }

            return(response);
        }
Exemplo n.º 2
0
 Sprint CreateSprint(CreateSprintRequest request, Project project)
 {
     return(sprintFactory.CreateSprint(request.Name, project, request.StartDate, request.EndDate));
 }
Exemplo n.º 3
0
        IValidationResult ValidateRequest(CreateSprintRequest request)
        {
            var validator = validatorFactory.GetValidator();

            return(validator.Validate(request));
        }