Ejemplo n.º 1
0
        /// <summary>
        /// List a user spending in the given order
        /// </summary>
        /// <param name="userId">Id of the user we want the spendings of</param>
        /// <param name="order">Property by which we want to order </param>
        /// <returns>The list of spending for the given user</returns>
        public IEnumerable <Spending> ListByUserId(int userId, SortSpendingBy order)
        {
            IEnumerable <Spending> spendings = this._spendingContext.Spendings.Where(s => s.UserId == userId);

            if (order == SortSpendingBy.Amount)
            {
                spendings = spendings.OrderBy(s => s.Amount);
            }
            else
            {
                spendings = spendings.OrderBy(s => s.DateInUtc);
            }

            return(spendings);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// List a user spending in the given order
 /// </summary>
 /// <param name="userId">Id of the user we want the spendings of</param>
 /// <param name="orderBy">Property by which we want to order </param>
 /// <returns>The list of spending for the given user</returns>
 public IEnumerable <Spending> ListByUserId(int userId, SortSpendingBy orderBy)
 {
     return(this._spendingRepository.ListByUserId(userId, orderBy));
 }