public IDataResult <Project> Add(Project project)
 {
     _validation = new Validation <ProjectValidator>();
     _validation.Validate(project);
     _projectDal.Add(project);
     return(new SuccessDataResult <Project>(project));
 }
 public IResult Add(Project project)
 {
     if (project.ProjectName.Length < 2)
     {
         return(new ErrorResult(Messages.InvalidValue));
     }
     _projectdal.Add(project);
     return(new SuccessResult(Messages.OperationSuccessful));
 }
Beispiel #3
0
 public void Add(Project project)
 {
     _projectDal.Add(project);
 }
Beispiel #4
0
 public IResult Add(Project project)
 {
     _projectDal.Add(project);
     return(new SuccessResult(Messages.ProjectAdded));
 }
Beispiel #5
0
        public void AddWithDefaultProject(Solution solution)
        {
            _solutionDal.Add(solution);

            var defaultUnits = new List <Unit>()
            {
                new Unit()
                {
                    Name        = "Base",
                    SourceType  = SourceType.System,
                    Description = "Represents the basic layer of the project. The whole architecture is shaped on this project.",
                    Solution    = solution
                },
                new Unit()
                {
                    Name        = "Libraries",
                    SourceType  = SourceType.System,
                    Description = "Stores libraries built on the basic architecture of the project. Entities, data access classes, business and service operations are managed here.",
                    Solution    = solution
                },
                new Unit()
                {
                    Name        = "Presentations",
                    SourceType  = SourceType.System,
                    Description = "Represents the presentation layer of the project. It includes user interfaces, web services and desktop applications.",
                    Solution    = solution
                },
                new Unit()
                {
                    Name        = "Tests",
                    SourceType  = SourceType.System,
                    Description = "It is the layer where the unit tests of the project are collected. Test operations are organized here.",
                    Solution    = solution
                }
            };

            foreach (var unit in defaultUnits)
            {
                _unitDal.Add(unit);
            }

            var defaultProjects = new List <Project>()
            {
                new Project
                {
                    Name          = "Core",
                    ProjectType   = ProjectType.classlib,
                    SourceType    = SourceType.System,
                    DirectoryName = solution.CompanyName + ".Core",
                    Unit          = _unitDal.Get(u => u.Solution == solution && u.Name == "Base")
                },
                new Project
                {
                    Name          = "Business",
                    ProjectType   = ProjectType.classlib,
                    SourceType    = SourceType.System,
                    DirectoryName = solution.CompanyName + "." + solution.ProjectName + ".Business",
                    Unit          = _unitDal.Get(u => u.Solution == solution && u.Name == "Libraries")
                },
                new Project
                {
                    Name          = "DataAccess",
                    ProjectType   = ProjectType.classlib,
                    SourceType    = SourceType.System,
                    DirectoryName = solution.CompanyName + "." + solution.ProjectName + ".DataAccess",
                    Unit          = _unitDal.Get(u => u.Solution == solution && u.Name == "Libraries")
                },
                new Project
                {
                    Name          = "Entities",
                    ProjectType   = ProjectType.classlib,
                    SourceType    = SourceType.System,
                    DirectoryName = solution.CompanyName + "." + solution.ProjectName + ".Entities",
                    Unit          = _unitDal.Get(u => u.Solution == solution && u.Name == "Libraries")
                },
                new Project
                {
                    Name          = "Web.CoreMVC",
                    ProjectType   = ProjectType.mvc,
                    SourceType    = SourceType.System,
                    DirectoryName = solution.CompanyName + "." + solution.ProjectName + ".Web.CoreMVC",
                    Unit          = _unitDal.Get(u => u.Solution == solution && u.Name == "Presentations")
                }
            };

            foreach (var project in defaultProjects)
            {
                _projectDal?.Add(project);
            }
        }