hello guys,am kind of new to the webmatrix environment,am trying to implement the use of object oriented programming in webmatrix.AM using the entity framework to handle saving records into my database.here is the problem am facing
I already have a class called Students defined as follows
public class Student
{
public int ID{get;set;}
[Required]
public string Student_number{get;set;}
[Required(ErrorMessage="surname required")]
public string Surname{get;set;}
[Required (ErrorMessage="FirstName Required")]
public string Firstname{get;set;}
[Required(ErrorMessage="please enter your OtherNames")]
public string Othername{get;set;}
[Required(ErrorMessage="please enter your sex")]
public string Sex{get;set;}}
i have a student Repository class which is making reference to my entity framework to insert the records into the database
public class EFRepository
{
private EFDBContext context = new EFDBContext();
public IQueryable<student> Student{ get { return context.Students;} }
public void Save(Student student){
context.Students.Add(student);
context.SaveChanges();
}
}
in my page where i want to implenment this class is where am having an issue..
if i hardcode the values into the instance of the new class Student,the records gets saved.
however since the form is going to be filled by the user,the textboxes has to be responsible for parsing the values being entered by the user into the student class.
but am confused on how to implement it.
any help would be appreciated..THANKS