private bool MatchMethodName(string filter) { if (string.IsNullOrEmpty(filter)) { return(true); } return(MethodName.ToLower().Equals(filter.ToLower())); }
/// <summary> /// Validates the given element using the Values collection and generates an error if /// invalid. /// </summary> protected override void Validate(string element) { // TODO: Call method with parameters or null MethodInfo mi = ValidationSet.GetType().GetMethods(BindingFlags.Instance | BindingFlags.NonPublic) .Where(m => m.Name.ToLower() == MethodName.ToLower()).SingleOrDefault(); if (mi != null && mi.ReturnType == typeof(bool) && mi.GetParameters().Count() == 0) { if (!(bool)mi.Invoke(ValidationSet, null)) { InsertError(element); } } }
/// <summary> /// Returns the HttpMethod class based on the property MethodName /// </summary> /// <returns>It`s wheater Get, Post, Put or Delete</returns> public HttpMethod Method() { switch (MethodName.ToLower()) { case GET: return(HttpMethod.Get); case POST: return(HttpMethod.Post); case PUT: return(HttpMethod.Put); case DELETE: return(HttpMethod.Delete); default: return(HttpMethod.Get); } }