Example #1
0
        public ActionResult CreateProject(Project project)
        {
            //Check if there are any validation errors during model binding.
            //If validation is valid, Add project record to database
            //Else return view back to project

            if (ModelState.IsValid)
            {
                ProjectMember projectMember = new ProjectMember();

                //Add project record to database
                project.ProjectId = projectContext.Add(project);

                //set the property values for the projectmember to be prepared to insert into the database
                projectMember.ProjectId = project.ProjectId;

                //get the values for projectMember's studentID and set it to integer value
                projectMember.StudentId = HttpContext.Session.GetInt32("StudentID").Value;

                //projectmember role is = to  Leader
                projectMember.Role = "Leader";

                //projectContext method will add project as leader in projectmember
                projectContext.AddProjectAsLeader(projectMember);

                //Redirect user to Project/Index view
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(project));
            }
        }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Project model)
 {
     return(dal.Add(model));
 }
Example #3
0
 public void AddProject(ProjectEntity _jobKpiAssessment)
 {
     projectDAL.Add(_jobKpiAssessment);
 }