Exemplo n.º 1
0
        protected override IQueryable <Group> SortByField(IQueryable <Group> query, FieldSort field, bool isAscending)
        {
            if (field.Is(nameof(VmGroup.Name)))
            {
                query = query.SortBy(x => x.Name, isAscending);
            }

            else if (field.Is(nameof(VmGroup.Description)))
            {
                query = query.SortBy(x => x.Description, isAscending);
            }

            else if (field.Is(nameof(VmGroup.IsRemoved)))
            {
                query = query.SortBy(x => x.IsRemoved, isAscending);
            }

            else if (field.Is(nameof(VmGroup.OwnerFio)))
            {
                query = query
                        .SortBy(p => p.Owner.LastName, isAscending)
                        .SortBy(p => p.Owner.FirstName, isAscending)
                        .SortBy(p => p.Owner.MiddleName, isAscending);
            }

            return(query);
        }
Exemplo n.º 2
0
        protected override IQueryable <GoalMessage> SortByField(IQueryable <GoalMessage> query,
                                                                FieldSort field, bool isAscending)
        {
            if (field.Is(nameof(VmGoalMessage.CreationDate)))
            {
                query = query.SortBy(x => x.CreationDate, isAscending);
            }

            else if (field.Is(nameof(VmGoalMessage.Text)))
            {
                query = query.SortBy(x => x.Text, isAscending);
            }

            else if (field.Is(nameof(VmGoalMessage.GoalTitle)))
            {
                query = query.SortBy(x => x.Goal.Title, isAscending);
            }

            else if (field.Is(nameof(VmGoalMessage.LastEditDate)))
            {
                query = query.SortBy(x => x.LastEditDate, isAscending);
            }

            else if (field.Is(nameof(VmGoalMessage.OwnerFullName)))
            {
                query = query
                        .SortBy(x => x.Owner.LastName, isAscending)
                        .SortBy(x => x.Owner.FirstName, isAscending)
                        .SortBy(x => x.Owner.MiddleName, isAscending);
            }

            else if (field.Is(nameof(VmGoalMessage.IsRemoved)))
            {
                query = query.SortBy(x => x.IsRemoved, isAscending);
            }

            return(query);
        }