Ejemplo n.º 1
0
        public ActionResult Create(ServerProject serverproject)
        {
            if (ModelState.IsValid)
            {
                db.ServerProjects.Add(serverproject);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.ServerID = new SelectList(db.Servers, "ServerID", "ServerName", serverproject.ServerID);
            ViewBag.ProjectID = new SelectList(db.Projects, "ProjectID", "ProjectName", serverproject.ProjectID);
            return View(serverproject);
        }
Ejemplo n.º 2
0
 //
 // GET: /ServerProject/
 public ActionResult Index(int? projectid)
 {
     if (projectid != null)
     {
         IEnumerable<ServerProject> filterbyproject = db.ServerProjects.Where(s => s.ProjectID == projectid).ToList();
         return View(filterbyproject);
     }
     ServerProject sa = new ServerProject();
     var serverprojects = db.ServerProjects.Include(s => s.Server).Include(s => s.Project);
     return View(serverprojects.ToList());
 }
Ejemplo n.º 3
0
 public ActionResult Edit(ServerProject serverproject)
 {
     if (ModelState.IsValid)
     {
         db.Entry(serverproject).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.ServerID = new SelectList(db.Servers, "ServerID", "ServerName", serverproject.ServerID);
     ViewBag.ProjectID = new SelectList(db.Projects, "ProjectID", "ProjectName", serverproject.ProjectID);
     return View(serverproject);
 }