Beispiel #1
0
        public IActionResult Get(RootRequestModel requestModel)
        {
            #region predicate
            Expression <Func <EmailAccount, bool> > where = x => true;

            if (!string.IsNullOrWhiteSpace(requestModel.Name))
            {
                where = ExpressionHelpers.CombineAnd(where, a => a.Username.Contains(requestModel.Name));
            }


            #endregion

            var emailAccounts = _emailAccountService.GetPagedList(
                where,
                null,
                false,
                requestModel.Page - 1,
                requestModel.Count);
            if (emailAccounts == null)
            {
                return(RespondFailure());
            }

            var model = emailAccounts;//.Select(x => x.ToModel());

            return(RespondSuccess(model, emailAccounts.TotalCount));
        }