public Result<IEnumerable<ApplicationUser>> GetUsersByFilter(SearchUserEnum filter, string searchText)
        {
            Result<IEnumerable<ApplicationUser>> result = new Result<IEnumerable<ApplicationUser>>();

            try
            {
                switch (filter)
                {
                    case SearchUserEnum.Email:
                        result.Data = manager.Get(p => p.Email.ToLower().Contains(searchText.ToLower()));
                        break;

                    case SearchUserEnum.Name:
                        result.Data = manager.Get(p => (p.FirstName +  " " + p.LastName).ToLower()
                            .Contains(searchText.ToLower()));
                        break;

                    default:
                        break;
                }
                result.Status = ResultEnum.Success;
            }
            catch (Exception)
            {
                result.Status = ResultEnum.Fail;
            }

            return result;
        }
Exemple #2
0
        public Result <IEnumerable <ApplicationUser> > GetUsersByFilter(SearchUserEnum filter, string searchText)
        {
            Result <IEnumerable <ApplicationUser> > result = new Result <IEnumerable <ApplicationUser> >();

            try
            {
                switch (filter)
                {
                case SearchUserEnum.Email:
                    result.Data = manager.Get(p => p.Email.ToLower().Contains(searchText.ToLower()));
                    break;

                case SearchUserEnum.Name:
                    result.Data = manager.Get(p => (p.FirstName + " " + p.LastName).ToLower()
                                              .Contains(searchText.ToLower()));
                    break;

                default:
                    break;
                }
                result.Status = ResultEnum.Success;
            }
            catch (Exception)
            {
                result.Status = ResultEnum.Fail;
            }

            return(result);
        }