| | | 1 | | using Elsa.Identity.Entities; |
| | | 2 | | |
| | | 3 | | namespace Elsa.Identity.Models; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Represents an application filter. |
| | | 7 | | /// </summary> |
| | | 8 | | public class ApplicationFilter |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// Gets or sets the application ID to filter for. |
| | | 12 | | /// </summary> |
| | 0 | 13 | | public string? Id { get; set; } |
| | | 14 | | |
| | | 15 | | /// <summary> |
| | | 16 | | /// Gets or sets the application short ID to filter for. |
| | | 17 | | /// </summary> |
| | 0 | 18 | | public string? ClientId { get; set; } |
| | | 19 | | |
| | | 20 | | /// <summary> |
| | | 21 | | /// Gets or sets the application name to filter for. |
| | | 22 | | /// </summary> |
| | 0 | 23 | | public string? Name { get; set; } |
| | | 24 | | |
| | | 25 | | /// <summary> |
| | | 26 | | /// Applies the filter to the specified queryable. |
| | | 27 | | /// </summary> |
| | | 28 | | /// <param name="queryable">The queryable.</param> |
| | | 29 | | /// <returns>The filtered queryable.</returns> |
| | | 30 | | public IQueryable<Application> Apply(IQueryable<Application> queryable) |
| | | 31 | | { |
| | 0 | 32 | | var filter = this; |
| | 0 | 33 | | if (filter.Id != null) queryable = queryable.Where(x => x.Id == filter.Id); |
| | 0 | 34 | | if (filter.ClientId != null) queryable = queryable.Where(x => x.ClientId == filter.ClientId); |
| | 0 | 35 | | if (filter.Name != null) queryable = queryable.Where(x => x.Name == filter.Name); |
| | | 36 | | |
| | 0 | 37 | | return queryable; |
| | | 38 | | } |
| | | 39 | | } |