Esempio n. 1
0
        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");
        }
Esempio n. 2
0
 partial void DeleteProject(Project instance);
Esempio n. 3
0
 partial void UpdateProject(Project instance);
Esempio n. 4
0
 partial void InsertProject(Project instance);
Esempio n. 5
0
 /// <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;
 }
Esempio n. 6
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Project EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToProject(Project project)
 {
     base.AddObject("Project", project);
 }