public JsonResult ListSubject(Subject subject) { if (subject == null) { return(Json(new { Message = "Error", HasError = true }, JsonRequestBehavior.AllowGet)); } var dao = new SubjectDAO(); var List = dao.ListSubject(); if (!List.Any()) { return(Json(new { Message = "No entry found" }, JsonRequestBehavior.AllowGet)); } return(Json(List, JsonRequestBehavior.AllowGet)); }