public JsonResult GetOperationsForModule(int subModuleID) { IGumruk iGumruk = new BSGumruk(); List <app_module_operations> dbOperations = iGumruk.GetAllOperationsForModule(subModuleID); List <ModuleOperation> operationsResponse = new List <ModuleOperation>(); foreach (app_module_operations op in dbOperations) { string tableName = ""; if (op.d_b_tables != null) { tableName = op.d_b_tables.name; } operationsResponse.Add(new ModuleOperation(op.query, op.operation, op.d_b_tables_id, tableName, op.d_b_tables.d_b_schemas.name)); } return(Json(operationsResponse, JsonRequestBehavior.AllowGet)); }