Exemple #1
0
        public ActionResult Create(Project project)
        {
            if (ModelState.IsValid)
            {
                project.startTime = DateTime.Now;
                project.endTime = project.startTime;
                project.windowsLogon = User.Identity.Name.Substring(User.Identity.Name.IndexOf(@"\")+1);
                project.isDeployed = false;
                db.Projects.AddObject(project);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.sandpitID = new SelectList(db.Sandpits, "ID", "name", project.sandpitID);
            ViewBag.userID = new SelectList(db.Users, "ID", "name", project.userID);
            return View(project);
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Projects EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToProjects(Project project)
 {
     base.AddObject("Projects", project);
 }
 /// <summary>
 /// Create a new Project object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="name">Initial value of the name property.</param>
 /// <param name="description">Initial value of the description property.</param>
 /// <param name="startTime">Initial value of the startTime property.</param>
 /// <param name="endTime">Initial value of the endTime property.</param>
 /// <param name="userID">Initial value of the userID property.</param>
 /// <param name="sandpitID">Initial value of the sandpitID property.</param>
 /// <param name="isDeployed">Initial value of the isDeployed property.</param>
 public static Project CreateProject(global::System.Int32 id, global::System.String name, global::System.String description, global::System.DateTime startTime, global::System.DateTime endTime, global::System.Int32 userID, global::System.Int32 sandpitID, global::System.Boolean isDeployed)
 {
     Project project = new Project();
     project.ID = id;
     project.name = name;
     project.description = description;
     project.startTime = startTime;
     project.endTime = endTime;
     project.userID = userID;
     project.sandpitID = sandpitID;
     project.isDeployed = isDeployed;
     return project;
 }
Exemple #4
0
 public ActionResult Edit(Project project)
 {
     if (ModelState.IsValid)
     {
         db.Projects.Attach(project);
         db.ObjectStateManager.ChangeObjectState(project, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.sandpitID = new SelectList(db.Sandpits, "ID", "name", project.sandpitID);
     ViewBag.userID = new SelectList(db.Users, "ID", "name", project.userID);
     return View(project);
 }