public ActionResult Add(ProjectSection projectSection) { var result = _projectSectionService.Add(projectSection); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IResult Add(ProjectCreationDto projectCreationDto) { var project = _mapper.Map <ProjectCreationDto, Project>(projectCreationDto); project.ActiveWorkerCount = 0; project.RemainingProjectTime = project.TotalDeclaredTime; project.Status = true; _projectService.Add(project); foreach (var projectSection in projectCreationDto.ProjectSections) { var psection = new ProjectSection { ProjectID = project.ProjectID, ProjectSectionName = projectSection.ProjectSectionName, SectionProjectTime = projectSection.SectionProjectTime, }; _projectSectionService.Add(psection); foreach (var projectSectionDepartment in projectSection.ProjectSectionDepartment) { var psDepartment = new ProjectSectionDepartment { ProjectSectionID = psection.ProjectSectionID, DepartmentTypeID = projectSectionDepartment.DepartmentTypeID, Status = true }; _projectSectionDepartmentService.Add(psDepartment); } } return(new SuccessResult(Messages.ProjectAdded)); }