private static object GetParameterValue(PathParameter pathParameter, string source) { if (pathParameter.Type == typeof(string)) { return(source); } if (pathParameter.Type == typeof(int)) { int buffer; if (!int.TryParse(source, out buffer)) { return(null); } return(buffer); } if (pathParameter.Type == typeof(decimal)) { decimal buffer; if (!decimal.TryParse(source, out buffer)) { return(null); } return(buffer); } return(null); }
private static object GetParameterValue(PathParameter pathParameter, string source) { if (pathParameter.Type == typeof (string)) return source; if (pathParameter.Type == typeof (int)) { int buffer; if(!int.TryParse(source, out buffer)) return null; return buffer; } if (pathParameter.Type == typeof(decimal)) { decimal buffer; if (!decimal.TryParse(source, out buffer)) return null; return buffer; } return null; }