Skip to content

Commit 75189f0

Browse files
committed
update products grid
1 parent e17f640 commit 75189f0

File tree

8 files changed

+156
-119
lines changed

8 files changed

+156
-119
lines changed

README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,21 @@ The practical repository uses coolstore domain which is mainly borrowed from `ht
1616

1717
# Testing Application
1818

19-
Starting the web application
19+
- Starting the Api
2020

2121
```
22-
$ cd src\Web
23-
$ npm i
24-
$ npm run dev
22+
$ tye run
2523
```
2624

27-
Starting the Api
25+
- Starting the web application
2826

2927
```
30-
$ tye run
28+
$ cd src\Web
29+
$ npm i
30+
$ npm run dev
3131
```
3232

33-
```
34-
$ cd src\Product\ProductService.Api\
35-
$ dotnet run
36-
```
33+
- Public Apis:
3734

3835
> Frontend: [http://localhost:3000/products](http://localhost:3000/products)
3936
>

assets/products_screen.png

116 KB
Loading

src/BuildingBlocks/N8T.Core/Specification/GridSpecificationBase.cs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -46,42 +46,6 @@ protected void ApplyGroupBy(Expression<Func<T, object>> groupByExpression) =>
4646
protected void ApplySorting(string sort)
4747
{
4848
this.ApplySorting(sort, nameof(ApplyOrderBy), nameof(ApplyOrderByDescending));
49-
50-
/*if (string.IsNullOrEmpty(sort)) return;
51-
52-
const string descendingSuffix = "Desc";
53-
54-
var descending = sort.EndsWith(descendingSuffix, StringComparison.Ordinal);
55-
var propertyName = sort.Substring(0, 1).ToUpperInvariant() +
56-
sort.Substring(1, sort.Length - 1 - (descending ? descendingSuffix.Length : 0));
57-
58-
var specificationType = GetType().BaseType;
59-
var targetType = specificationType?.GenericTypeArguments[0];
60-
var property = targetType!.GetRuntimeProperty(propertyName) ??
61-
throw new InvalidOperationException($"Because the property {propertyName} does not exist it cannot be sorted.");
62-
63-
var lambdaParamX = Expression.Parameter(targetType, "x");
64-
65-
var propertyReturningExpression = Expression.Lambda(
66-
Expression.Convert(
67-
Expression.Property(lambdaParamX, property),
68-
typeof(object)),
69-
lambdaParamX);
70-
71-
if (descending)
72-
{
73-
specificationType?.GetMethod(
74-
nameof(ApplyOrderByDescending),
75-
BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
76-
?.Invoke(this, new object[]{propertyReturningExpression});
77-
}
78-
else
79-
{
80-
specificationType?.GetMethod(
81-
nameof(ApplyOrderBy),
82-
BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
83-
?.Invoke(this, new object[]{propertyReturningExpression});
84-
}*/
8549
}
8650
}
8751
}

src/BuildingBlocks/N8T.Core/Specification/SpecificationBase.cs

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ namespace N8T.Core.Specification
77
public abstract class SpecificationBase<T> : ISpecification<T>
88
{
99
public abstract Expression<Func<T, bool>> Criteria { get; }
10-
public virtual List<Expression<Func<T, bool>>> Criterias { get; } = new();
1110
public List<Expression<Func<T, object>>> Includes { get; } = new();
1211
public List<string> IncludeStrings { get; } = new();
1312
public Expression<Func<T, object>> OrderBy { get; private set; }
@@ -47,42 +46,6 @@ protected void ApplyGroupBy(Expression<Func<T, object>> groupByExpression) =>
4746
protected void ApplySorting(string sort)
4847
{
4948
this.ApplySorting(sort, nameof(ApplyOrderBy), nameof(ApplyOrderByDescending));
50-
51-
/*if (string.IsNullOrEmpty(sort)) return;
52-
53-
const string descendingSuffix = "Desc";
54-
55-
var descending = sort.EndsWith(descendingSuffix, StringComparison.Ordinal);
56-
var propertyName = sort.Substring(0, 1).ToUpperInvariant() +
57-
sort.Substring(1, sort.Length - 1 - (descending ? descendingSuffix.Length : 0));
58-
59-
var specificationType = GetType().BaseType;
60-
var targetType = specificationType?.GenericTypeArguments[0];
61-
var property = targetType!.GetRuntimeProperty(propertyName) ??
62-
throw new InvalidOperationException($"Because the property {propertyName} does not exist it cannot be sorted.");
63-
64-
var lambdaParamX = Expression.Parameter(targetType, "x");
65-
66-
var propertyReturningExpression = Expression.Lambda(
67-
Expression.Convert(
68-
Expression.Property(lambdaParamX, property),
69-
typeof(object)),
70-
lambdaParamX);
71-
72-
if (descending)
73-
{
74-
specificationType?.GetMethod(
75-
nameof(ApplyOrderByDescending),
76-
BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
77-
?.Invoke(this, new object[]{propertyReturningExpression});
78-
}
79-
else
80-
{
81-
specificationType?.GetMethod(
82-
nameof(ApplyOrderBy),
83-
BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
84-
?.Invoke(this, new object[]{propertyReturningExpression});
85-
}*/
8649
}
8750
}
8851
}

src/Web/package-lock.json

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Web/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88
"start": "next start"
99
},
1010
"dependencies": {
11+
"@fortawesome/fontawesome-svg-core": "^1.2.34",
12+
"@fortawesome/free-solid-svg-icons": "^5.15.2",
13+
"@fortawesome/react-fontawesome": "^0.1.14",
1114
"@zeit/next-css": "^1.0.1",
1215
"@zeit/next-less": "^1.0.1",
1316
"@zeit/next-sass": "^1.0.1",
1417
"axios": "^0.21.1",
1518
"bootstrap": "^4.6.0",
1619
"lodash": "^4.17.20",
20+
"moment": "^2.29.1",
1721
"next": "10.0.6",
1822
"next-images": "^1.7.0",
1923
"nprogress": "^0.2.0",

0 commit comments

Comments
 (0)