Class QueryCollectionExtensions
Defines a collection of extensions for
Inheritance
Namespace: MADE.Web.Extensions
Assembly: MADE.Web.dll
Syntax
public static class QueryCollectionExtensions : object
Methods
| Improve this Doc View SourceGetDateTimeValueOrDefault(IQueryCollection, String, DateTime)
Gets a query
by the specified key
.
Declaration
public static DateTime GetDateTimeValueOrDefault(this IQueryCollection query, string key, DateTime defaultValue)
Parameters
Type | Name | Description |
---|---|---|
IQueryCollection | query | The query to retrieve a |
System.String | key | The key associated with the parameter to retrieve. |
DateTime | defaultValue | The default value if the value does not exist. |
Returns
Type | Description |
---|---|
DateTime | The |
GetIntValueOrDefault(IQueryCollection, String, Int32, Boolean)
Gets an integer value from the query
by the specified key
.
Declaration
public static int GetIntValueOrDefault(this IQueryCollection query, string key, int defaultValue, bool treatZeroAsEmpty = true)
Parameters
Type | Name | Description |
---|---|---|
IQueryCollection | query | The query to retrieve an integer value from. |
System.String | key | The key associated with the parameter to retrieve. |
System.Int32 | defaultValue | The default value if the value does not exist. |
System.Boolean | treatZeroAsEmpty | A value indicating whether to treat 0 as empty. True by default. |
Returns
Type | Description |
---|---|
System.Int32 | The integer value for the specified |
GetStringValueOrDefault(IQueryCollection, String, String)
Gets a string value from the query
by the specified key
.
Declaration
public static string GetStringValueOrDefault(this IQueryCollection query, string key, string defaultValue = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryCollection | query | The query to retrieve a string value from. |
System.String | key | The key associated with the parameter to retrieve. |
System.String | defaultValue | The default value if the value does not exist. |
Returns
Type | Description |
---|---|
System.String | The string value for the specified |