Tuesday, 27 November 2018

MVC - Entity Framework - JSON - Fix Error - Enumeration yielded no results

Watch this example on YouTube


To fix it replace

       public JsonResult GetUserList()
        {
            IEnumerable<Users_SelectAll_Result> model = db.Users_SelectAll();
            return Json(model);
        }

with

       public JsonResult GetUserList()
        {
            IEnumerable<Users_SelectAll_Result> model = db.Users_SelectAll().ToList();
            return Json(model);
        }

No comments:

Post a Comment