public ActionResult ClassWiseInActiveStudents() { string classanme = ReportsController.classname; if (classname == "All") { return(RedirectToAction("InActiveStudents", "Reports")); } int classid = 1; DB37Entities db = new DB37Entities(); classid = db.Classtbls.Where(t => t.Section == classname).FirstOrDefault().Id; //CrMVCApp.Models.Customer c; var c = db.ShowClassWiseInActiveStudents(classid).ToList(); InActiveStudentsReport rpt = new InActiveStudentsReport(); rpt.Load(); rpt.SetDataSource(c); Stream s = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return(File(s, "application/pdf")); }