Example #1
0
        public DeploymentUnit AddArtefactToPackage(DeployableArtefact artefact, Build build)
        {
            if (DeploymentUnits.Any(du => du.DeployableArtefact == artefact && du.Build == build)) throw new ArgumentException(String.Format("The artefact:{0} build:{1} has already been added", artefact.DeployableArtefactName, build.BuildLabel));

            var deploymentUnit = new DeploymentUnit(build, artefact);
            DeploymentUnits.Add(deploymentUnit);
            return deploymentUnit;
        }
Example #2
0
 public DeploymentUnit(Build build, DeployableArtefact deployableArtefact)
 {
     if (build == null) throw new ArgumentNullException("build must not be null");
     if (deployableArtefact == null) throw new ArgumentNullException("deployableArtefact must not be null");
     Build = build;
     DeployableArtefact = deployableArtefact;
     HostDeployments = new List<HostDeployment>();
     ReleaseStatus = ReleaseStatus.Pending;
     DeploymentUnitID = Guid.NewGuid();
     Trace.WriteLine("Created new " + this.ToString());
 }
        public ActionResult Create(DeployableArtefact deployableartefact)
        {
            if (ModelState.IsValid)
            {
                deployableartefact.DeployableArtefactID = Guid.NewGuid();
                db.DeployableArtefacts.Add(deployableartefact);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(deployableartefact);
        }
Example #4
0
 public void AddArtefact(string artefactName, string fileName, string hostRole)
 {
     if (DeployableArtefacts.Any(da => da.DeployableArtefactName == artefactName)) throw new ArgumentException("Deployable artefact already added");
     try
     {
         var deployableArtefact = new DeployableArtefact()
         {
             DeployableArtefactID = Guid.NewGuid(),
             DeployableArtefactName = artefactName,
             FileName = fileName,
             HostRole = hostRole
         };
         DeployableArtefacts.Add(deployableArtefact);
         SaveChanges();
     }
     catch (Exception ex)
     {
         throw new ApplicationException("Could not add Deployable Artefact", ex);
     }
 }
 public ActionResult Edit(DeployableArtefact deployableartefact)
 {
     if (ModelState.IsValid)
     {
         db.Entry(deployableartefact).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(deployableartefact);
 }
Example #6
0
 public void RemoveArtefactFromPackage(DeployableArtefact artefact)
 {
     DeploymentUnits.RemoveAll(du => du.DeployableArtefact == artefact);
 }