Exemple #1
0
 public FilterDtoSearchObject()
 {
     MaxPrice = "0";
     MinLikes = "0";
     SearchBy = string.Empty;
     sort     = new SortByDto[0];
 }
Exemple #2
0
        public static IQueryable <TEntity> OrderBy <TEntity>(this IQueryable <TEntity> source, SortByDto orderBy)
        {
            string command           = orderBy.Desc ? "OrderByDescending" : "OrderBy";
            var    type              = typeof(TEntity);
            var    property          = type.GetProperty(orderBy.Property);
            var    parameter         = Expression.Parameter(type, "p");
            var    propertyAccess    = Expression.MakeMemberAccess(parameter, property);
            var    orderByExpression = Expression.Lambda(propertyAccess, parameter);
            var    resultExpression  = Expression.Call(typeof(Queryable), command, new Type[] { type, property.PropertyType },
                                                       source.Expression, Expression.Quote(orderByExpression));

            return(source.Provider.CreateQuery <TEntity>(resultExpression));
        }
Exemple #3
0
        public Task <IEnumerable <CustomerDto> > PostCustomers(IEnumerable <CustomerDto> customers, SortByDto sortBy)
        {
            var apiMethod = string.Format("Sort/GetOrderedCustomerDetails?sortBy={0}", sortBy);

            return(_httpClientWrapper.PostAsJsonAsync <IEnumerable <CustomerDto> >(apiMethod, customers));
        }