public void InsertProject_Test() { // ARRANGE CreateProjectType(); var projectType = this.uow.ProjectTypes.GetAll().First(); var projectCreateParam = new ProjectCreateParam { Description = "Test description", Name = "Test project", ProjectType = projectType }; var projectLogic = new ProjectLogic(); // ACT projectLogic.InsertProject(projectCreateParam); projectLogic.Dispose(); this.uow.Dispose(); this.uow = new UnitOfWork(); // ASSERT var createdProject = this.uow.Projects.GetAll().First(); Assert.IsNotNull(createdProject); Assert.AreEqual(EnumDefinition.ProjectStatus.Active, createdProject.ProjectStatus); }
public ActionResult NewProject(Project project, Guid[] teamEmployees, Budget[] budgets) { ProjectLogic logic = new ProjectLogic(); var result = logic.InsertProject(project, teamEmployees, budgets); return(Json(new { Result = result })); }
private void btn_AddProject_Click(object sender, RoutedEventArgs e) { if (this.SelectedProjectType != null && this.CanCreateProject && !editMode && !string.IsNullOrWhiteSpace(this.tb_projectDesignation.Text)) { var bllProjectTypes = new ProjectTypeLogic(); var bllProjects = new ProjectLogic(); var projectType = bllProjectTypes.GetProjectType(this.SelectedProjectType.Id); var viewModel = new ProjectCreateViewModel { Description = tb_projectDescription.Text, Name = tb_projectDesignation.Text, ProjectType = projectType }; bllProjects.InsertProject(viewModel); bllProjects.Dispose(); bllProjectTypes.Dispose(); this.Close(); } else if (this.SelectedProjectType != null && this.CanCreateProject && editMode) { var bllProjectTypes = new ProjectTypeLogic(); var bllProjects = new ProjectLogic(); var projectType = bllProjectTypes.GetProjectType(this.SelectedProjectType.Id); var viewModel = new ProjectUpdateViewModel { Description = this.tb_projectDescription.Text, Name = this.tb_projectDesignation.Text }; bllProjects.UpdateProject(viewModel, projectId); bllProjects.Dispose(); bllProjectTypes.Dispose(); this.Close(); } }