public RedirectResult AddNewProject(string projectName, string projectDescription) { string email = ((FormsIdentity)System.Web.HttpContext.Current.User.Identity).Name.ToString(); User signedUser = db.Users.Where(user => user.email.Trim() == email).Single(); Project newProject = new Project(); newProject.projectName = projectName; newProject.description = projectDescription; newProject.idOwner = signedUser.idUser; newProject.dateCreated = DateTime.Now; db.Projects.InsertOnSubmit(newProject); db.SubmitChanges(); sif_ProjectUser newMember = new sif_ProjectUser(); newMember.idProject = newProject.idProject; newMember.idUser = signedUser.idUser; db.sif_ProjectUsers.InsertOnSubmit(newMember); db.SubmitChanges(); return Redirect("/Dashboard/Index"); }
partial void DeleteProject(Project instance);
partial void UpdateProject(Project instance);
partial void InsertProject(Project instance);
/// <summary> /// Create a new Project object. /// </summary> /// <param name="idProject">Initial value of the idProject property.</param> /// <param name="projectName">Initial value of the projectName property.</param> /// <param name="dateCreated">Initial value of the dateCreated property.</param> /// <param name="idOwner">Initial value of the idOwner property.</param> public static Project CreateProject(global::System.Int32 idProject, global::System.String projectName, global::System.DateTime dateCreated, global::System.Int32 idOwner) { Project project = new Project(); project.idProject = idProject; project.projectName = projectName; project.dateCreated = dateCreated; project.idOwner = idOwner; return project; }
/// <summary> /// Deprecated Method for adding a new object to the Project EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToProject(Project project) { base.AddObject("Project", project); }