public void ModelTests_CreatingReleasePackage_InitialStub()
        {
            PopulateTestData();

            // create some release packages
            var rp_test = new ReleasePackage("Test Release 1", DateTime.Now.AddMinutes(20), "TEST");
            //var rp_staging = new ReleasePackage("Staging Release 1", DateTime.Now.AddMinutes(20), "STAGE");

            // need to have deployment units
            DeployableArtefacts
                //.Where(da => da.HostRole == "SQL Server")
                .ToList()
                .ForEach(da =>
                {
                    //rp_test.AddDeploymentUnit(new DeploymentUnit(Builds.First(), da));
                    //rp_staging.AddDeploymentUnit(new DeploymentUnit(Builds[2], da));
                });

            // show the pending deployment package
            Debug.WriteLine(rp_test.ToString());

            // deploy to some hosts (we will target them all, but use the environment filter)
            rp_test.DeployToHosts(Hosts);

            Debug.WriteLine(rp_test.ToString());
        }
        public ActionResult Create(ReleasePackage releasepackage)
        {
            if (ModelState.IsValid)
            {
                releasepackage.ReleasePackageID = Guid.NewGuid();
                releasepackage.PlatformEnvironment = "TEST";
                releasepackage.ReleaseDate = DateTime.Now;
                releasepackage.ReleaseStatus = ReleaseStatus.Queued;
                db.ReleasePackages.Add(releasepackage);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(releasepackage);
        }
 public ActionResult Edit(ReleasePackage releasepackage)
 {
     if (ModelState.IsValid)
     {
         db.Entry(releasepackage).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(releasepackage);
 }
 public ReleasePackage AddReleasePackage(string releaseName, DateTime releaseDate, string environment)
 {
     try
     {
         var rp = new ReleasePackage(releaseName, releaseDate, environment);
         ReleasePackages.Add(rp);
         SaveChanges();
         return rp;
     }
     catch (Exception ex)
     {
         throw new ApplicationException("Could not add Release Package", ex);
     }
 }