예제 #1
0
        public static DbQuery <UserCard> ToDbQuery(this AccountCardsQuery query)
        {
            Argument.NotNull(query, "query");
            var dbQuery = DbQuery.For <UserCard>().FilterBy(x => x.Account.AccountNo == query.AccountNo);

            if (query.IsActive.HasValue)
            {
                dbQuery.AndFilterBy(x => x.IsActive == query.IsActive.Value);
            }
            return(dbQuery);
        }
예제 #2
0
 public IList <CardModel> GetAccountCards(AccountCardsQuery query)
 {
     EnsureIsValid(query);
     try
     {
         var userCards = _deps.UserCards.Project <CardModel>(query.ToDbQuery());
         return(userCards);
     }
     catch (Exception ex)
     {
         throw new ServiceException("Cannot get cards for account.", ex);
     }
 }
 public IHttpActionResult Cards([FromUri] AccountCardsQuery query)
 {
     return(Ok(_cardAccountService.GetAccountCards(query)));
 }