Add user search

This commit is contained in:
2013-01-05 20:56:27 -05:00
parent f9844d0f38
commit d5d58c1649
7 changed files with 63 additions and 4 deletions
+13
View File
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.SqlTypes;
using System.Linq;
using System.Web.Mvc;
using System.Web.Security;
@@ -96,5 +97,17 @@ namespace MileageTraker.Web.Models
LastLoginDate, LastActivityDate,
LastPasswordChangedDate, LastLockoutDate);
}
public bool Filter(string q)
{
if (string.IsNullOrEmpty(q))
return true;
var queries = q.Split(' ');
return queries.Any(query =>
Username.IndexOf(query, StringComparison.OrdinalIgnoreCase) >= 0
|| FullName.IndexOf(query, StringComparison.OrdinalIgnoreCase) >= 0);
}
}
}