Exemple #1
0
 public virtual Task <ActionResult> ValueFilter(string property, string value, string selected = null)
 {
     return(Task.Run <ActionResult>(() =>
     {
         IPropertyMetadata p = Metadata.GetProperty(property);
         if (p == null)
         {
             return new HttpStatusCodeResult(404);
         }
         ValueFilterAttribute filterAttribute = p.GetAttribute <ValueFilterAttribute>();
         if (filterAttribute == null)
         {
             return new HttpStatusCodeResult(400);
         }
         IValueFilter filter = (IValueFilter)Resolver.GetService(filterAttribute.ValueFilter);
         ViewBag.Selected = selected;
         ViewBag.IsRequired = p.IsRequired;
         var collection = filter.GetValues(filterAttribute.DependencyProperty, value);
         return View(collection);
     }));
 }