am very new to ASP.NET USING MVC Controllers...so here is my scenario.Am developing an Online Admission system where students come and fill in their required records to be processed for admission.I have different classes that holds specific information about the student.My student class is:
public class Student
{
public int ID { get; set; }
[Required]
public string NAME { get; set; }
[Required]
public string FIRSTNAME { get; set; }
[Required]
public string LASTNAME { get; set; }
public virtual ICollection<Enrollment> Enrollments { get; set; }
}
I have another class called Enrollments where the user Enters all the courses as well as the Grade
public class Enrollment
{
public int EnrollmentID { get; set; }
public int CourseID { get; set; }
public int StudentID { get; set; }
public Grade Grade { get; set; }
public virtual Student Student
{
get;
set;
}
public virtual Course Course { get; set; }
}
public enum Grade
{
A,B,C,D,E,F
}
}
AND different more classes.I HAVE A CONTROLLER called Registration, where i will create the views for each Classes.
SO IN my first View which takes all the student Details,after the Record has been saved.
when the user Clicks next,i want to pass the ID number of the student class to my next view which is the Enrollment View and save the records along with the ID number of the student class which is acting as a foreign key in the enrollment class and database.
Have been trying so hard 2 implement this but with no success.I would appreciate a simple example to demonstrate how to achieve this because am not too good using the mvc framework as i recently started using ASP.NET.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…