public JsonResult GetPublication(int?id) { if (id != null) { Publication p1 = new Publication() { PublishedId = id.Value, EmployeeId = Convert.ToInt32(Session["EmpId"].ToString()) }; string z = JsonConvert.SerializeObject(p1.GetPublication()); return(Json(z, JsonRequestBehavior.AllowGet)); } else { return(Json("Some thing going wrong please try again later", JsonRequestBehavior.AllowGet)); } }