1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- //using Microsoft.AspNetCore.Http;
- namespace Extensions
- {
- public static partial class Extensions
- {
- public static bool IsEmpty(this object value)
- {
- if (value != null && !string.IsNullOrEmpty(value.ParseToString()))
- {
- return false;
- }
- else
- {
- return true;
- }
- }
- public static bool IsNotEmpty(this object value)
- {
- return !IsEmpty(value);
- }
- public static bool IsNullOrZero(this object value)
- {
- if (value == null || value.ParseToString().Trim() == "0")
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- //public static bool IsAjaxRequest(this HttpRequest request)
- //{
- // if (request == null)
- // throw new ArgumentNullException("request");
- // if (request.Headers != null)
- // return request.Headers["X-Requested-With"] == "XMLHttpRequest";
- // return false;
- //}
- }
- }
|