Add user search
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user