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; }
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(Build build) { if (ModelState.IsValid) { build.BuildID = Guid.NewGuid(); db.Builds.Add(build); db.SaveChanges(); return RedirectToAction("Index"); } return View(build); }
public ActionResult Edit(Build build) { if (ModelState.IsValid) { db.Entry(build).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(build); }
public void AddBuild(string buildLabel, DateTime buildDate, string dropLocation) { if (Builds.Any(b => b.BuildLabel == buildLabel)) throw new InvalidOperationException(String.Format("A build with label '{0}' already exists.", buildLabel)); try { var build = new Build() { BuildLabel = buildLabel, BuildDate = buildDate, BuildID = Guid.NewGuid(), BuildName = "Build " + buildLabel + " on " + buildDate.ToString(), DropLocation = dropLocation }; Builds.Add(build); SaveChanges(); } catch (Exception ex) { throw new ApplicationException("Could not add Build. " + ex.Message, ex); } }