Exemplo n.º 1
0
        public void CreateProject(int id)
        {
            var solution = _solutionDal.GetWithProjectId(id);
            var project  = _projectDal.Get(p => p.Id == id);

            _commandService.Run(new List <string>()
            {
                @"cd .\" + solution.CompanyName,
                @"dotnet new " + project.ProjectType + " -n " + project.DirectoryName,
                @"dotnet sln add .\" + project.DirectoryName
            });
            switch (project.ProjectType)
            {
            case ProjectType.classlib:
                _commandService.Run(new List <string>()
                {
                    @"cd .\" + solution.CompanyName + @"\" + project.DirectoryName,
                    @"del class1.cs"
                });
                break;

            case ProjectType.mvc:
                _commandService.Run(new List <string>()
                {
                    @"cd .\" + solution.CompanyName + @"\" + project.DirectoryName,
                    @"cd .\Controllers",
                    @"del HomeController.cs",
                    @"cd..",
                    @"cd .\Views",
                    @"del /F /Q .\Home",
                    @"rmdir .\Home",
                    @"cd..",
                    @"del /F /Q .\wwwroot"
                });
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemplo n.º 2
0
 public Project GetById(int id)
 {
     return(_projectDal.Get(p => p.Id == id));
 }