public static void GenerateData() { //Set up some test data using (ISession session = _factory.OpenSession()) { //Save venues Venue venue = new Venue { Name="Main Venue"}; session.Save(venue); //Save courses Course course1 = new Course {CourseNumber = 1, Venue = venue}; Course course2 = new Course { CourseNumber = 2, Venue = venue }; session.Save(course1); session.Save(course2); //Save students Student student1 = new Student {Name="Student 1"}; student1.Courses.Add(course1); student1.Courses.Add(course2); session.Save(student1); Student student2 = new Student { Name = "Student 2" }; student2.Courses.Add(course1); session.Save(student2); session.Flush(); } }
public Student Build() { var student = new Student { RollNumber = this.RollNumber, FirstName = this.FirstName, LastName = this.LastName, Department = this.Department }; return student; }
protected void AddStudentButtonClick(object sender, EventArgs e) { string spassword=studentPasswordTextBox.Text; string sname=studentNameTextBox.Text; string sdepart=studentDepartDropDownList.SelectedValue; string sgrade=studentGradeDropDownList.SelectedValue; string sclassName = studentClassNameDropDownList.SelectedValue; Student newStudent = new Student { studentName = sname, studentPassword=spassword, studentDepart=sdepart, studentGrade=sgrade, studentClassName=sclassName }; AdminController admin = (AdminController)Session["adminController"]; admin.AddStudent(newStudent); Response.Redirect("AllStudentPage.aspx"); }
public PartialViewResult RegisterStudent(Student model) { if (!ModelState.IsValid) return PartialView("StudentRegistration"); _repository.SaveStudent(model); return PartialView("RegistrationFinished", new RegistrationFinishedModel() { Name = model.Name, Surname = model.Surname, Email = model.Email }); }