public JsonResult GetAllClassification(DataSourceRequest command, int?foundByFunctionId = null) { var classifications = _classificationService.GetAllAsync().Result.ToList(); if (foundByFunctionId.HasValue) { classifications = classifications.Where(x => x.FoundByFunctionId == foundByFunctionId.Value).ToList(); } //else // classifications = classifications.Where(x => x.Id == -1).ToList(); var data = classifications.Select(x => new ClassificationModel { Id = x.Id, Code = x.Code, Name = x.Id + " -- " + x.Name, Description = x.Description, FoundByFunction = new FoundByFunctionModel() { Id = x.FoundByFunctionId ?? 0 } }); return(Json(data, JsonRequestBehavior.AllowGet)); }