Exemple #1
0
 private ProjectServiceCreateValidationEntity GetCreateValidationEntity(DraftProject draftProject, Program program)
 {
     return(new ProjectServiceCreateValidationEntity(
                name: draftProject.Name,
                description: draftProject.Description,
                program: program
                ));
 }
Exemple #2
0
        /// <summary>
        /// Creates and returns project asyncronously
        /// </summary>
        /// <param name="draftProject">The project to create</param>
        /// <returns>The project that was created</returns>
        public async Task <Project> CreateAsync(DraftProject draftProject)
        {
            var program = await GetProgramByIdAsync(draftProject.ProgramId);

            this.logger.Trace("Retrieved program by id {0}.", draftProject.ProgramId);
            validator.ValidateCreate(GetCreateValidationEntity(draftProject, program));
            var project = DoCreate(draftProject, program);

            this.logger.Trace("Created project {0}.", project);
            return(project);
        }
Exemple #3
0
        private Project DoCreate(DraftProject draftProject, Program program)
        {
            var project = new Project
            {
                Name            = draftProject.Name,
                Description     = draftProject.Description,
                StartDate       = DateTimeOffset.Now,
                ProjectStatusId = draftProject.StatusId,
                ProjectTypeId   = 0, // need to figure this out
                ProgramId       = draftProject.ProgramId,
                Themes          = program.Themes,
                Goals           = program.Goals,
                VisitorTypeId   = VisitorType.NotApplicable.Id
            };

            draftProject.Audit.SetHistory(project);
            this.Context.Projects.Add(project);
            return(project);
        }
Exemple #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="project"></param>
 /// <returns></returns>
 public Task <Project> CreateAsync(DraftProject project)
 {
     Contract.Requires(project != null, "The project must not be null.");
     return(Task.FromResult <Project>(null));
 }
Exemple #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="project"></param>
 /// <returns></returns>
 public Project Create(DraftProject project)
 {
     Contract.Requires(project != null, "The project must not be null.");
     return(null);
 }