public JsonResult StudentByID(int?id)
 {
     using (CRUDDbContext db = new CRUDDbContext())
     {
         return(Json(db.Employees.Where(x => x.EmployeeID == id).ToList(), JsonRequestBehavior.AllowGet));
     }
 }
 public JsonResult ListStudent()
 {
     using (CRUDDbContext db = new CRUDDbContext())
     {
         return(Json(db.Employees.ToList(), JsonRequestBehavior.AllowGet));
     }
 }
 public ActionResult GetData()
 {
     using (CRUDDbContext db = new CRUDDbContext())
     {
         List <Employee> employees = db.Employees.ToList <Employee>();
         return(Json(new { data = employees }, JsonRequestBehavior.AllowGet));
     }
 }
Example #4
0
 public EmployeeRepository(CRUDDbContext context)
 {
     _dbContext = context;
 }
Example #5
0
 public EmployeeRepository()
 {
     _dbContext = new CRUDDbContext();
 }