Esempio n. 1
0
 public void DeployToHost(Host host)
 {
     if (host == null) throw new ArgumentNullException("host", "host must not be null");
     Trace.WriteLine("Adding new Host to " + ToString());
     HostDeployments.Add(new HostDeployment() { HostDeploymentId = Guid.NewGuid(), DeploymentUnit = this, Host = host });
     ReleaseStatus = ReleaseStatus.InProgress;
 }
Esempio n. 2
0
        public ActionResult Create(Host host)
        {
            if (ModelState.IsValid)
            {
                host.HostID = Guid.NewGuid();
                db.Hosts.Add(host);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(host);
        }
Esempio n. 3
0
 public void UpdateHost(Host host)
 {
     try
     {
         var updatingHost = Hosts.Single(h => h.HostName == host.HostName);
         updatingHost.Environment = host.Environment;
         updatingHost.HostRole = host.HostRole;
         SaveChanges();
     }
     catch (Exception ex)
     {
         throw new ApplicationException(String.Format("Problem updating Host '{0}'. " + ex.Message, host.HostName), ex);
     }
 }
Esempio n. 4
0
 public void AddHost(string hostName, string hostRole, string environment)
 {
     try
     {
         if (Hosts.Any(h => h.HostName == hostName)) throw new InvalidOperationException(String.Format("Host '{0}' already exists", hostName));
         var host = new Host()
         {
             HostID = Guid.NewGuid(),
             HostName = hostName,
             HostRole = hostRole,
             Environment = environment
         };
         Hosts.Add(host);
         SaveChanges();
     }
     catch (Exception ex)
     {
         throw new ApplicationException(String.Format("Problem adding Host '{0}'. " + ex.Message, hostName), ex);
     }
 }
Esempio n. 5
0
 public ActionResult Edit(Host host)
 {
     if (ModelState.IsValid)
     {
         db.Entry(host).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(host);
 }