Beispiel #1
0
        public IActionResult Create(PipelineViewModel pvm)
        {
            var cat = _catalogRepository.GetById(pvm.Catalog.CatalogId);

            var pl1 = pvm.Pipeline;

            pl1.Catalog = cat;

            if (pl1.JenkinsWebAPI != null)
            {
                pl1.JenkinsWebAPI = pl1.JenkinsWebAPI.Trim().ToString();
            }

            if (pl1.JenkinsWebAPI != null)
            {
                if (pl1.JenkinsWebAPI.Length > 0 && pl1.JenkinsWebAPI.Substring(pl1.JenkinsWebAPI.Length - 1) != "/")
                {
                    pl1.JenkinsWebAPI += "/";
                }
            }

            if (pl1.JenkinsWebAPI != null)
            {
                if (pl1.JenkinsWebAPI.Length > 0 && pl1.JenkinsWebAPI.Substring(pl1.JenkinsWebAPI.Length - 4) != "job/")
                {
                    pl1.JenkinsWebAPI += "job/";
                }
            }

            if (pl1.ServiceNowWebAPI != null)
            {
                pl1.ServiceNowWebAPI = pl1.ServiceNowWebAPI.Trim().ToString();
            }

            if (pl1.ServiceNowWebAPI != null)
            {
                if (pl1.ServiceNowWebAPI.Length > 0 && pl1.ServiceNowWebAPI.Substring(pl1.ServiceNowWebAPI.Length - 1) != "/")
                {
                    pl1.ServiceNowWebAPI += "/";
                }
            }

            _pipelineRepository.Create(pl1);

            return(RedirectToRoute(new
            {
                controller = "Catalog",
                action = "View",
                id = cat.CatalogId
            }));
        }