public ActionResult GetBatchBySubjectId(int classId) { var batches = _batchService.GetBatchesBySubjectId(classId).Select(x => new { x.BatchId, x.BatchName }); batches = batches.Distinct().ToList(); var result = new { batches = batches, }; return(Json(result, JsonRequestBehavior.AllowGet)); }