AccountProfile.Controllers.ProfileController.Find C# (CSharp) Method

Find() public method

public Find ( ProfileSearchCriteria criteria ) : System.Web.Mvc.ViewResult
criteria AccountProfile.Models.ProfileSearchCriteria
return System.Web.Mvc.ViewResult
        public ViewResult Find(ProfileSearchCriteria criteria)
        {
            var profileQuery = _profileRepository.Find();

            if (criteria.FirstName != null)
                profileQuery = profileQuery.Where(p => p.FirstName != null && p.FirstName.Contains(criteria.FirstName));
            if (criteria.LastName != null)
                profileQuery = profileQuery.Where(p => p.LastName != null && p.LastName.Contains(criteria.LastName));

            var matchingProfiles = profileQuery.ToArray();

            return View("Index", matchingProfiles);
        }