Get records by Id method using DbContext in asp.net webforms

laurierat

New Member
Here, in Asp.Net, normal webforms, I'm using dependency injection for retrieving records. I have also used Entity Framework hereI have a class and a interface shown below..\[code\]public partial class Student { public Student() { } public Student StudentID { get; set; } public string StudentName { get; set; } public string Address { get; set; } }public interface IStudentService { Student GetStudentsById(Student StudentID); IList<Student> GetAllStudents(); }\[/code\]created a context class\[code\]public partial class Entities : DbContext { public DbSet<Student> Students { get; set; } }\[/code\]then implemented the interface\[code\]public partial class StudentService : IStudentService { Entities db = new Entities(); public virtual Student GetStudentsById(Student StudentID) { //need to implement } public virtual IList<Student> GetAllStudents() { //need to implement } }\[/code\]Now, could anyone help me to implement these methodsThanks in Advance
 
Back
Top