diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
new file mode 100644
index 000000000..f27e1f774
--- /dev/null
+++ b/.github/workflows/build-and-test.yml
@@ -0,0 +1,108 @@
+name: Basic Build and Test
+
+on:
+ push:
+ branches: [ main ]
+ pull_request:
+ branches: [ main ]
+
+jobs:
+ build-and-test:
+ name: Build, Test and Analyze
+ runs-on: ubuntu-latest
+ env:
+ ASSISTANT_ID: ${{ secrets.ASSISTANT_ID }}
+
+ steps:
+ # 1. Checkout source code
+ - name: Checkout code
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0 # Shallow clones should be disabled for a better relevance of analysis
+
+ # 2. Install required dependencies (Setup environment)
+ # Uses global.json to pick the correct .NET SDK version
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ global-json-file: global.json
+
+ # JDK 17 is required for SonarScanner
+ - name: Set up JDK 17
+ uses: actions/setup-java@v4
+ with:
+ java-version: 17
+ distribution: 'zulu'
+
+ # Install the SonarScanner tool globally
+ - name: Install SonarCloud scanner
+ run: |
+ dotnet tool install --global dotnet-sonarscanner
+
+ # 3. SonarCloud Begin (Quality Check Setup)
+ - name: Begin Sonar scan
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Necesario para comentar en el PR
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+ run: |
+ dotnet sonarscanner begin /k:"epam-ai_eShop" /o:"epam-ai" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vstest.reportsPaths="**/*.trx" /d:sonar.cs.vscoveragexml.reportsPaths="**/coverage.cobertura.xml"
+
+ # 4. Install dependencies (Restore)
+ - name: Restore dependencies
+ run: dotnet restore eShop.slnx
+
+ # 5. Build the application
+ - name: Build
+ run: dotnet build eShop.slnx --no-restore --configuration Debug
+
+ # 6. Run automated tests
+ # Fails pipeline if tests fail. Generates coverage for SonarQube.
+ - name: Test
+ run: dotnet test --solution eShop.Web.slnf --no-build --no-progress --output detailed
+
+ # 7. Execute SonarCloud Analysis (End)
+ # This pushes the analysis to the server and performs the quality gate check
+ - name: End Sonar scan
+ env:
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+ run: dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
+
+ - name: Get Access Token
+ id: auth
+ env:
+ CODEMIE_CLIENT_ID: ${{ secrets.CODEMIE_CLIENT_ID }}
+ CODEMIE_CLIENT_SECRET: ${{ secrets.CODEMIE_CLIENT_SECRET }}
+ run: |
+ set -euo pipefail
+
+ ACCESS_TOKEN=$(curl -s -X POST 'https://keycloak.eks-core.aws.main.edp.projects.epam.com/auth/realms/codemie-prod/protocol/openid-connect/token' \
+ -H 'Content-Type: application/x-www-form-urlencoded' \
+ -d 'grant_type=password' \
+ -d 'client_id=codemie-sdk' \
+ -d "username=${CODEMIE_CLIENT_ID}" \
+ -d "password=${CODEMIE_CLIENT_SECRET}" | jq -r '.access_token')
+
+ if [[ -z "${ACCESS_TOKEN}" || "${ACCESS_TOKEN}" == "null" ]]; then
+ echo "Failed to obtain access token" >&2
+ exit 1
+ fi
+
+ echo "access_token=${ACCESS_TOKEN}" >> $GITHUB_OUTPUT
+ echo "Access token obtained successfully"
+
+ - name: Call CodeMie Agent
+ env:
+ ACCESS_TOKEN: ${{ steps.auth.outputs.access_token }}
+ run: |
+ set -euo pipefail
+
+ RESPONSE=$(curl -s -X POST "https://codemie.lab.epam.com/code-assistant-api/v1/assistants/${ASSISTANT_ID}/model" \
+ -H "Content-Type: application/json" \
+ -H "Accept: application/json" \
+ -H "Authorization: Bearer $ACCESS_TOKEN" \
+ -d "{\"text\": \"Hi\"}")
+ echo "$RESPONSE"
+ GENERATED=$(echo "$RESPONSE" | jq -r '.generated')
+
+ echo "CodeMie Agent Response:"
+ echo "$GENERATED"
\ No newline at end of file
diff --git a/.github/workflows/codemieAgent.yml b/.github/workflows/codemieAgent.yml
new file mode 100644
index 000000000..09886f8eb
--- /dev/null
+++ b/.github/workflows/codemieAgent.yml
@@ -0,0 +1,69 @@
+name: Call CodeMie Agent
+
+on:
+ workflow_dispatch:
+ inputs:
+ prompt:
+ description: Prompt to send to CodeMie Agent
+ required: true
+ type: string
+
+jobs:
+ call:
+ runs-on: ubuntu-latest
+ env:
+ ASSISTANT_ID: ${{ secrets.ASSISTANT_ID }}
+ PROMPT: ${{ inputs.prompt }}
+ steps:
+ - name: Get Access Token
+ id: auth
+ env:
+ CODEMIE_CLIENT_ID: ${{ secrets.CODEMIE_CLIENT_ID }}
+ CODEMIE_CLIENT_SECRET: ${{ secrets.CODEMIE_CLIENT_SECRET }}
+ run: |
+ set -euo pipefail
+
+ ACCESS_TOKEN=$(curl -s -X POST 'https://keycloak.eks-core.aws.main.edp.projects.epam.com/auth/realms/codemie-prod/protocol/openid-connect/token' \
+ -H 'Content-Type: application/x-www-form-urlencoded' \
+ -d 'grant_type=password' \
+ -d 'client_id=codemie-sdk' \
+ -d "username=${CODEMIE_CLIENT_ID}" \
+ -d "password=${CODEMIE_CLIENT_SECRET}" | jq -r '.access_token')
+
+ if [[ -z "${ACCESS_TOKEN}" || "${ACCESS_TOKEN}" == "null" ]]; then
+ echo "Failed to obtain access token" >&2
+ exit 1
+ fi
+
+ echo "access_token=${ACCESS_TOKEN}" >> $GITHUB_OUTPUT
+ echo "Access token obtained successfully"
+
+ - name: Call CodeMie Agent
+ env:
+ ACCESS_TOKEN: ${{ steps.auth.outputs.access_token }}
+ run: |
+ set -euo pipefail
+
+ RESPONSE=$(curl -s -X POST "https://codemie.lab.epam.com/code-assistant-api/v1/assistants/${ASSISTANT_ID}/model" \
+ -H "Content-Type: application/json" \
+ -H "Accept: application/json" \
+ -H "Authorization: Bearer $ACCESS_TOKEN" \
+ -d "{\"text\": \"${PROMPT}\"}")
+ echo "$RESPONSE"
+ GENERATED=$(echo "$RESPONSE" | jq -r '.generated')
+ RESULT=$(echo "$GENERATED" | grep -oP 'result: \K\w+' | head -1)
+ DETAIL=$(echo "$GENERATED" | sed -n '/detail:/,$p' | sed '1d')
+
+ echo "CodeMie Agent Response:"
+ echo "$DETAIL"
+
+ if [[ "$RESULT" != "true" ]]; then
+ echo "Pipeline failed: result is false" >&2
+ exit 1
+ fi
+
+ - name: Validate Workflow
+ run: |
+ RANDOM_ID=$(uuidgen)
+ echo "Workflow validation ID: $RANDOM_ID"
+
diff --git a/.github/workflows/markdownlint-problem-matcher.json b/.github/workflows/markdownlint-problem-matcher.json
deleted file mode 100644
index f0741f6b9..000000000
--- a/.github/workflows/markdownlint-problem-matcher.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "problemMatcher": [
- {
- "owner": "markdownlint",
- "pattern": [
- {
- "regexp": "^([^:]*):(\\d+):?(\\d+)?\\s([\\w-\\/]*)\\s(.*)$",
- "file": 1,
- "line": 2,
- "column": 3,
- "code": 4,
- "message": 5
- }
- ]
- }
- ]
-}
diff --git a/.github/workflows/markdownlint.yml b/.github/workflows/markdownlint.yml
deleted file mode 100644
index 9cb00dc5a..000000000
--- a/.github/workflows/markdownlint.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-name: Markdownlint
-
-permissions:
- contents: read
-
-# run even on changes without markdown changes, so that we can
-# make it in GitHub a required check for PR's
-on:
- pull_request:
-
-jobs:
- lint:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v4
- - name: Use Node.js
- uses: actions/setup-node@v4
- with:
- node-version: 16.x
- - name: Run Markdownlint
- run: |
- echo "::add-matcher::.github/workflows/markdownlint-problem-matcher.json"
- npm i -g markdownlint-cli
- markdownlint --ignore '.dotnet/' '**/*.md'
diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml
index 7aa5749ed..d3ba936c6 100644
--- a/.github/workflows/playwright.yml
+++ b/.github/workflows/playwright.yml
@@ -28,12 +28,7 @@ jobs:
with:
node-version: lts/*
- name: Install dependencies
- run: npm ci
- - name: Install .NET HTTPS Development Certificate
- # if: matrix.os == 'ubuntu-latest'
- run: |
- dotnet dev-certs https --clean
- dotnet dev-certs https --trust
+ run: npm install
- name: Install Playwright Browsers
run: npx playwright install chromium
- name: Run Playwright tests
@@ -42,6 +37,10 @@ jobs:
ESHOP_USE_HTTP_ENDPOINTS: 1
USERNAME1: bob
PASSWORD: Pass123$
+ RP_API_KEY: ${{ secrets.REPORTPORTAL_API_KEY }}
+ RP_ENDPOINT: "https://reportportal.epam.com/api/v1"
+ RP_PROJECT: ${{ secrets.REPORTPORTAL_PROJECT }}
+ RP_LAUNCH: "Playwright E2E | ${{ github.repository }} | ${{ github.ref_name }} | #${{ github.run_number }}"
- uses: actions/upload-artifact@v4
if: always()
with:
diff --git a/.github/workflows/pr-validation-maui.yml b/.github/workflows/pr-validation-maui.yml
deleted file mode 100644
index 2f63a0943..000000000
--- a/.github/workflows/pr-validation-maui.yml
+++ /dev/null
@@ -1,42 +0,0 @@
-name: eShop Pull Request Validation - .NET MAUI
-
-on:
- pull_request:
- branches:
- - '**'
- paths:
- - 'src/ClientApp/**'
- - 'tests/ClientApp.UnitTests/**'
- - '.github/workflows/pr-validation-maui.yml'
- push:
- branches:
- - main
- paths:
- - 'src/ClientApp/**'
- - 'tests/ClientApp.UnitTests/**'
- - '.github/workflows/pr-validation-maui.yml'
-
-jobs:
- test:
- runs-on: windows-latest
- steps:
- - uses: actions/checkout@v4
- - name: Setup .NET (global.json)
- uses: actions/setup-dotnet@v3
-
- - name: Update Workloads
- run: dotnet workload update
-
- - name: Install Workloads
- shell: pwsh
- run: |
- dotnet workload install android
- dotnet workload install ios
- dotnet workload install maccatalyst
- dotnet workload install maui
-
- - name: Build
- run: dotnet build src/ClientApp/ClientApp.csproj
-
- - name: Test
- run: dotnet test --project tests/ClientApp.UnitTests/ClientApp.UnitTests.csproj --no-progress --output detailed
\ No newline at end of file
diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml
deleted file mode 100644
index 77431a0ca..000000000
--- a/.github/workflows/pr-validation.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-name: eShop Pull Request Validation
-
-on:
- pull_request:
- paths-ignore:
- - '**.md'
- - 'src/ClientApp/**'
- - 'tests/ClientApp.UnitTests/**'
- - '.github/workflows/pr-validation-maui.yml'
- push:
- branches:
- - main
- paths-ignore:
- - '**.md'
- - 'src/ClientApp/**'
- - 'tests/ClientApp.UnitTests/**'
- - '.github/workflows/pr-validation-maui.yml'
-
-jobs:
- test:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - name: Setup .NET (global.json)
- uses: actions/setup-dotnet@v3
- - name: Build
- run: dotnet build eShop.Web.slnf
- - name: Test
- run: dotnet test --solution eShop.Web.slnf --no-build --no-progress --output detailed
\ No newline at end of file
diff --git a/README.md b/README.md
index a56eecbf9..db0fb2281 100644
--- a/README.md
+++ b/README.md
@@ -8,10 +8,8 @@ A reference .NET application implementing an e-commerce website using a services
## Getting Started
-This version of eShop is based on .NET 9.
-
-Previous eShop versions:
-* [.NET 8](https://github.com/dotnet/eShop/tree/release/8.0)
+This version of eShop is based on [.NET 10](https://dotnet.microsoft.com/en-us/download/dotnet/10.0).
+You need to have this version of the SDK installed in your laptop to run the app.
### Prerequisites
@@ -79,8 +77,10 @@ then look for lines like this in the console output in order to find the URL to
Login to the dashboard at: http://localhost:19888/login?t=uniquelogincodeforyou
```
-> You may need to install ASP.NET Core HTTPS development certificates first, and then close all browser tabs. Learn more at https://aka.ms/aspnet/https-trust-dev-cert
-
+> You may need to install ASP.NET Core HTTPS development certificates first, and then close all browser tabs running the below command. Learn more at https://aka.ms/aspnet/https-trust-dev-cert
+```sh
+dotnet dev-certs https --trust
+```
### Azure Open AI
When using Azure OpenAI, inside *eShop.AppHost/appsettings.json*, add the following section:
diff --git a/eShop.slnx b/eShop.slnx
index 42061bab1..5d1c13a6f 100644
--- a/eShop.slnx
+++ b/eShop.slnx
@@ -1,36 +1,33 @@
+
+
+
+
+
+
-
+
-
+
+
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/package.json b/package.json
index 5d5626b97..9023f857b 100644
--- a/package.json
+++ b/package.json
@@ -12,6 +12,7 @@
"devDependencies": {
"@playwright/test": "^1.42.1",
"@types/node": "^20.11.25",
- "dotenv": "^16.4.5"
+ "dotenv": "^16.4.5",
+ "@reportportal/agent-js-playwright": "^5.3.2"
}
}
diff --git a/playwright.config.ts b/playwright.config.ts
index 9728afbcd..70aa43aec 100644
--- a/playwright.config.ts
+++ b/playwright.config.ts
@@ -17,8 +17,33 @@ export default defineConfig({
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
- /* Reporter to use. See https://playwright.dev/docs/test-reporters */
- reporter: 'html',
+ /* Reporter to use. See https://playwright.dev/docs/test-reporters */
+ reporter: process.env.CI
+ ? (process.env.RP_API_KEY && process.env.RP_ENDPOINT && process.env.RP_PROJECT
+ ? [
+ ['html'],
+ ['@reportportal/agent-js-playwright', {
+ apiKey: process.env.RP_API_KEY,
+ endpoint: process.env.RP_ENDPOINT,
+ project: process.env.RP_PROJECT,
+ launch: process.env.RP_LAUNCH || 'Playwright E2E Tests',
+ description: 'eShop Playwright E2E Tests',
+ mode: 'DEFAULT',
+ debug: false,
+ attributes: [
+ {
+ key: 'environment',
+ value: 'CI'
+ }
+ ],
+ restClientConfig: {
+ timeout: 30000
+ }
+ }]
+ ]
+ : [['html']]
+ )
+ : 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
diff --git a/src/ClientApp/Animations/Base/AnimationBase.cs b/src/ClientApp/Animations/Base/AnimationBase.cs
deleted file mode 100644
index 2e90c3f61..000000000
--- a/src/ClientApp/Animations/Base/AnimationBase.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-using System.Diagnostics;
-
-namespace eShop.ClientApp.Animations.Base;
-
-public abstract class AnimationBase : BindableObject
-{
- public static readonly BindableProperty TargetProperty = BindableProperty.Create(nameof(Target),
- typeof(VisualElement), typeof(AnimationBase),
- propertyChanged: (bindable, oldValue, newValue) => ((AnimationBase)bindable).Target = (VisualElement)newValue);
-
- public static readonly BindableProperty DurationProperty = BindableProperty.Create(nameof(Duration), typeof(string),
- typeof(AnimationBase), "1000",
- propertyChanged: (bindable, oldValue, newValue) => ((AnimationBase)bindable).Duration = (string)newValue);
-
- public static readonly BindableProperty EasingProperty = BindableProperty.Create(nameof(Easing), typeof(EasingType),
- typeof(AnimationBase), EasingType.Linear,
- propertyChanged: (bindable, oldValue, newValue) => ((AnimationBase)bindable).Easing = (EasingType)newValue);
-
- public static readonly BindableProperty RepeatForeverProperty = BindableProperty.Create(nameof(RepeatForever),
- typeof(bool), typeof(AnimationBase), false,
- propertyChanged: (bindable, oldValue, newValue) => ((AnimationBase)bindable).RepeatForever = (bool)newValue);
-
- public static readonly BindableProperty DelayProperty = BindableProperty.Create(nameof(Delay), typeof(int),
- typeof(AnimationBase), 0,
- propertyChanged: (bindable, oldValue, newValue) => ((AnimationBase)bindable).Delay = (int)newValue);
-
- private bool _isRunning;
-
- public VisualElement Target
- {
- get => (VisualElement)GetValue(TargetProperty);
- set => SetValue(TargetProperty, value);
- }
-
- public string Duration
- {
- get => (string)GetValue(DurationProperty);
- set => SetValue(DurationProperty, value);
- }
-
- public EasingType Easing
- {
- get => (EasingType)GetValue(EasingProperty);
- set => SetValue(EasingProperty, value);
- }
-
- public bool RepeatForever
- {
- get => (bool)GetValue(RepeatForeverProperty);
- set => SetValue(RepeatForeverProperty, value);
- }
-
- public int Delay
- {
- get => (int)GetValue(DelayProperty);
- set => SetValue(DelayProperty, value);
- }
-
- protected abstract Task BeginAnimation();
-
- public async Task Begin()
- {
- try
- {
- if (!_isRunning)
- {
- _isRunning = true;
-
- await InternalBegin()
- .ContinueWith(t => t.Exception, TaskContinuationOptions.OnlyOnFaulted)
- .ConfigureAwait(false);
- }
- }
- catch (TaskCanceledException)
- {
- }
- catch (Exception ex)
- {
- Debug.WriteLine($"Exception in animation {ex}");
- }
- }
-
- protected abstract Task ResetAnimation();
-
- public async Task Reset()
- {
- _isRunning = false;
- await ResetAnimation();
- }
-
- private async Task InternalBegin()
- {
- if (Delay > 0)
- {
- await Task.Delay(Delay);
- }
-
- if (!RepeatForever)
- {
- await BeginAnimation();
- }
- else
- {
- do
- {
- await BeginAnimation();
- await ResetAnimation();
- } while (RepeatForever);
- }
- }
-}
diff --git a/src/ClientApp/Animations/Base/EasingType.cs b/src/ClientApp/Animations/Base/EasingType.cs
deleted file mode 100644
index a04627d37..000000000
--- a/src/ClientApp/Animations/Base/EasingType.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-namespace eShop.ClientApp.Animations.Base;
-
-public enum EasingType
-{
- BounceIn,
- BounceOut,
- CubicIn,
- CubicInOut,
- CubicOut,
- Linear,
- SinIn,
- SinInOut,
- SinOut,
- SpringIn,
- SpringOut
-}
diff --git a/src/ClientApp/Animations/FadeToAnimation.cs b/src/ClientApp/Animations/FadeToAnimation.cs
deleted file mode 100644
index 5d2998a46..000000000
--- a/src/ClientApp/Animations/FadeToAnimation.cs
+++ /dev/null
@@ -1,155 +0,0 @@
-using eShop.ClientApp.Animations.Base;
-using eShop.ClientApp.Helpers;
-
-namespace eShop.ClientApp.Animations;
-
-public class FadeToAnimation : AnimationBase
-{
- public static readonly BindableProperty OpacityProperty =
- BindableProperty.Create(nameof(Opacity), typeof(double), typeof(FadeToAnimation), 0.0d,
- propertyChanged: (bindable, oldValue, newValue) =>
- ((FadeToAnimation)bindable).Opacity = (double)newValue);
-
- public double Opacity
- {
- get => (double)GetValue(OpacityProperty);
- set => SetValue(OpacityProperty, value);
- }
-
- protected override Task BeginAnimation()
- {
- if (Target == null)
- {
- throw new NullReferenceException("Null Target property.");
- }
-
- return Target.FadeTo(Opacity, Convert.ToUInt32(Duration), EasingHelper.GetEasing(Easing));
- }
-
- protected override Task ResetAnimation()
- {
- if (Target == null)
- {
- throw new NullReferenceException("Null Target property.");
- }
-
- return Target.FadeTo(0, 0);
- }
-}
-
-public class FadeInAnimation : AnimationBase
-{
- public enum FadeDirection
- {
- Up,
- Down
- }
-
- public static readonly BindableProperty DirectionProperty =
- BindableProperty.Create(nameof(Direction), typeof(FadeDirection), typeof(FadeInAnimation), FadeDirection.Up,
- propertyChanged: (bindable, oldValue, newValue) =>
- ((FadeInAnimation)bindable).Direction = (FadeDirection)newValue);
-
- public FadeDirection Direction
- {
- get => (FadeDirection)GetValue(DirectionProperty);
- set => SetValue(DirectionProperty, value);
- }
-
- protected override Task BeginAnimation()
- {
- if (Target == null)
- {
- throw new NullReferenceException("Null Target property.");
- }
-
- Target.Dispatcher.Dispatch(() => Target.Animate("FadeIn", FadeIn(), 16, Convert.ToUInt32(Duration)));
-
- return Task.CompletedTask;
- }
-
- protected override Task ResetAnimation()
- {
- if (Target == null)
- {
- throw new NullReferenceException("Null Target property.");
- }
-
- Target.Dispatcher.Dispatch(() => Target.FadeTo(0, 0));
-
- return Task.CompletedTask;
- }
-
- internal Animation FadeIn()
- {
- var animation = new Animation();
-
- animation.WithConcurrent(f => Target.Opacity = f, 0, 1, Microsoft.Maui.Easing.CubicOut);
-
- animation.WithConcurrent(
- f => Target.TranslationY = f,
- Target.TranslationY + (Direction == FadeDirection.Up ? 50 : -50), Target.TranslationY,
- Microsoft.Maui.Easing.CubicOut);
-
- return animation;
- }
-}
-
-public class FadeOutAnimation : AnimationBase
-{
- public enum FadeDirection
- {
- Up,
- Down
- }
-
- public static readonly BindableProperty DirectionProperty =
- BindableProperty.Create(nameof(Direction), typeof(FadeDirection), typeof(FadeOutAnimation), FadeDirection.Up,
- propertyChanged: (bindable, oldValue, newValue) =>
- ((FadeOutAnimation)bindable).Direction = (FadeDirection)newValue);
-
- public FadeDirection Direction
- {
- get => (FadeDirection)GetValue(DirectionProperty);
- set => SetValue(DirectionProperty, value);
- }
-
- protected override Task BeginAnimation()
- {
- if (Target == null)
- {
- throw new NullReferenceException("Null Target property.");
- }
-
- Target.Dispatcher.Dispatch(() => Target.Animate("FadeOut", FadeOut(), 16, Convert.ToUInt32(Duration)));
-
- return Task.CompletedTask;
- }
-
- protected override Task ResetAnimation()
- {
- if (Target == null)
- {
- throw new NullReferenceException("Null Target property.");
- }
-
- Target.Dispatcher.Dispatch(() => Target.FadeTo(0, 0));
-
- return Task.CompletedTask;
- }
-
- internal Animation FadeOut()
- {
- Animation animation = new();
-
- animation.WithConcurrent(
- f => Target.Opacity = f,
- 1, 0);
-
- animation.WithConcurrent(
- f => Target.TranslationY = f,
- Target.TranslationY, Target.TranslationY + (Direction == FadeDirection.Up ? 50 : -50));
-
- return animation;
- }
-}
diff --git a/src/ClientApp/Animations/StoryBoard.cs b/src/ClientApp/Animations/StoryBoard.cs
deleted file mode 100644
index df8d745a5..000000000
--- a/src/ClientApp/Animations/StoryBoard.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using eShop.ClientApp.Animations.Base;
-
-namespace eShop.ClientApp.Animations;
-
-[ContentProperty("Animations")]
-public class StoryBoard : AnimationBase
-{
- public StoryBoard()
- {
- Animations = new List();
- }
-
- public StoryBoard(List animations)
- {
- Animations = animations;
- }
-
- public List Animations { get; }
-
- protected override async Task BeginAnimation()
- {
- foreach (var animation in Animations)
- {
- if (animation.Target == null)
- {
- animation.Target = Target;
- }
-
- await animation.Begin();
- }
- }
-
- protected override async Task ResetAnimation()
- {
- foreach (var animation in Animations)
- {
- if (animation.Target == null)
- {
- animation.Target = Target;
- }
-
- await animation.Reset();
- }
- }
-}
diff --git a/src/ClientApp/App.xaml b/src/ClientApp/App.xaml
deleted file mode 100644
index bd3a678bf..000000000
--- a/src/ClientApp/App.xaml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ClientApp/App.xaml.cs b/src/ClientApp/App.xaml.cs
deleted file mode 100644
index a5ae3a114..000000000
--- a/src/ClientApp/App.xaml.cs
+++ /dev/null
@@ -1,167 +0,0 @@
-using System.Diagnostics;
-using System.Globalization;
-using eShop.ClientApp.Services;
-using eShop.ClientApp.Services.AppEnvironment;
-using eShop.ClientApp.Services.Location;
-using eShop.ClientApp.Services.Settings;
-using eShop.ClientApp.Services.Theme;
-using Location = eShop.ClientApp.Models.Location.Location;
-
-namespace eShop.ClientApp;
-
-public partial class App : Application
-{
- private readonly IAppEnvironmentService _appEnvironmentService;
- private readonly ILocationService _locationService;
- private readonly INavigationService _navigationService;
- private readonly ISettingsService _settingsService;
- private readonly ITheme _theme;
-
- public App(
- ISettingsService settingsService, IAppEnvironmentService appEnvironmentService,
- INavigationService navigationService, ILocationService locationService,
- ITheme theme)
- {
- _settingsService = settingsService;
- _appEnvironmentService = appEnvironmentService;
- _navigationService = navigationService;
- _locationService = locationService;
- _theme = theme;
-
- InitializeComponent();
-
- InitApp();
-
-
- Current.UserAppTheme = AppTheme.Light;
- }
-
- protected override Window CreateWindow(IActivationState activationState)
- {
- return new Window(new AppShell(_navigationService));
- }
-
- private void InitApp()
- {
- if (VersionTracking.IsFirstLaunchEver)
- {
- _settingsService.UseMocks = true;
- }
-
- if (!_settingsService.UseMocks)
- {
- _appEnvironmentService.UpdateDependencies(_settingsService.UseMocks);
- }
- }
-
- protected override async void OnStart()
- {
- base.OnStart();
-
- if (_settingsService.AllowGpsLocation && !_settingsService.UseFakeLocation)
- {
- await GetGpsLocation();
- }
-
- if (!_settingsService.UseMocks)
- {
- await SendCurrentLocation();
- }
-
- OnResume();
- }
-
- protected override void OnSleep()
- {
- SetStatusBar();
- RequestedThemeChanged -= App_RequestedThemeChanged;
- }
-
- protected override void OnResume()
- {
- SetStatusBar();
- RequestedThemeChanged += App_RequestedThemeChanged;
- }
-
- private void App_RequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
- {
- Dispatcher.Dispatch(() => SetStatusBar());
- }
-
- private void SetStatusBar()
- {
- var nav = Windows[0].Page as NavigationPage;
-
- if (Current.RequestedTheme == AppTheme.Dark)
- {
- _theme?.SetStatusBarColor(Colors.Black, false);
- if (nav != null)
- {
- nav.BarBackgroundColor = Colors.Black;
- nav.BarTextColor = Colors.White;
- }
- }
- else
- {
- _theme?.SetStatusBarColor(Colors.White, true);
- if (nav != null)
- {
- nav.BarBackgroundColor = Colors.White;
- nav.BarTextColor = Colors.Black;
- }
- }
- }
-
- private async Task GetGpsLocation()
- {
- try
- {
- var request = new GeolocationRequest(GeolocationAccuracy.High);
- var location = await Geolocation.GetLocationAsync(request, CancellationToken.None).ConfigureAwait(false);
-
- if (location != null)
- {
- _settingsService.Latitude = location.Latitude.ToString();
- _settingsService.Longitude = location.Longitude.ToString();
- }
- }
- catch (Exception ex)
- {
- if (ex is FeatureNotEnabledException || ex is FeatureNotEnabledException || ex is PermissionException)
- {
- _settingsService.AllowGpsLocation = false;
- }
-
- // Unable to get location
- Debug.WriteLine(ex);
- }
- }
-
- private async Task SendCurrentLocation()
- {
- var location = new Location
- {
- Latitude = double.Parse(_settingsService.Latitude, CultureInfo.InvariantCulture),
- Longitude = double.Parse(_settingsService.Longitude, CultureInfo.InvariantCulture)
- };
-
- await _locationService.UpdateUserLocation(location);
- }
-
- public static void HandleAppActions(AppAction appAction)
- {
- if (Current is not App app)
- {
- return;
- }
-
- app.Dispatcher.Dispatch(
- async () =>
- {
- if (appAction.Id.Equals(AppActions.ViewProfileAction.Id))
- {
- await app._navigationService.NavigateToAsync("//Main/Profile");
- }
- });
- }
-}
diff --git a/src/ClientApp/AppActions.cs b/src/ClientApp/AppActions.cs
deleted file mode 100644
index b6f5468e4..000000000
--- a/src/ClientApp/AppActions.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace eShop.ClientApp;
-
-public static class AppActions
-{
- public static readonly AppAction
- ViewProfileAction = new("view_profile", "View Profile", "View your user profile");
-}
diff --git a/src/ClientApp/AppShell.xaml b/src/ClientApp/AppShell.xaml
deleted file mode 100644
index f24f5c0a9..000000000
--- a/src/ClientApp/AppShell.xaml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ClientApp/AppShell.xaml.cs b/src/ClientApp/AppShell.xaml.cs
deleted file mode 100644
index dab4ba961..000000000
--- a/src/ClientApp/AppShell.xaml.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using eShop.ClientApp.Services;
-using eShop.ClientApp.Views;
-
-namespace eShop.ClientApp;
-
-public partial class AppShell : Shell
-{
- private readonly INavigationService _navigationService;
-
- public AppShell(INavigationService navigationService)
- {
- _navigationService = navigationService;
-
- InitializeRouting();
- InitializeComponent();
- }
-
- protected override async void OnHandlerChanged()
- {
- base.OnHandlerChanged();
-
- if (Handler is not null)
- {
- await _navigationService.InitializeAsync();
- }
- }
-
- private static void InitializeRouting()
- {
- //Routing.RegisterRoute("Login", typeof(LoginView));
- Routing.RegisterRoute("Filter", typeof(FiltersView));
- Routing.RegisterRoute("ViewCatalogItem", typeof(CatalogItemView));
- Routing.RegisterRoute("Basket", typeof(BasketView));
- Routing.RegisterRoute("Settings", typeof(SettingsView));
- Routing.RegisterRoute("OrderDetail", typeof(OrderDetailView));
- Routing.RegisterRoute("Checkout", typeof(CheckoutView));
- }
-}
diff --git a/src/ClientApp/ClientApp.csproj b/src/ClientApp/ClientApp.csproj
deleted file mode 100644
index c1c133240..000000000
--- a/src/ClientApp/ClientApp.csproj
+++ /dev/null
@@ -1,109 +0,0 @@
-
-
-
- net10.0-android;net10.0-ios;net10.0-maccatalyst;net10.0
- $(TargetFrameworks);net10.0-windows10.0.19041.0
-
-
-
-
-
-
- Exe
- eShop.ClientApp
- true
- true
- enable
- true
- false
- $(NoWarn);XC0103
-
-
- AdventureWorks
-
-
- com.companyname.eshop
- 9a85b8a9-4da5-4a12-8e7f-43c05ab266d6
-
-
- 1.0
- 1
- 15.0
- 15.0
- 21.0
- 10.0.17763.0
- 10.0.17763.0
- 6.5
-
-
- false
-
-
-
-
-
-
-
- #edeafb
- 128,128
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
-
-
-
-
-
-
-
-
-
- MSBuild:Compile
-
-
-
-
- $(RuntimeIdentifiers);android-arm64
-
-
-
-
-
-
- Platforms/MacCatalyst/Entitlements.Debug.plist
-
-
-
- Platforms/MacCatalyst/Entitlements.Release.plist
- true
-
-
-
- Platforms\iOS\Entitlements.plist
-
-
-
diff --git a/src/ClientApp/ClientApp.sln b/src/ClientApp/ClientApp.sln
deleted file mode 100644
index 4908745d9..000000000
--- a/src/ClientApp/ClientApp.sln
+++ /dev/null
@@ -1,37 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.5.002.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClientApp", "ClientApp.csproj", "{A70E29B3-9C96-40F7-839E-7350508D4F33}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClientApp.UnitTests", "..\..\tests\ClientApp.UnitTests\ClientApp.UnitTests.csproj", "{E260CC6D-1695-43AA-918A-B5EF4049A3E9}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{96432572-F84E-43FE-99BC-F23638D2D7A5}"
- ProjectSection(SolutionItems) = preProject
- ..\..\.github\workflows\client-app-validation.yml = ..\..\.github\workflows\client-app-validation.yml
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {A70E29B3-9C96-40F7-839E-7350508D4F33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A70E29B3-9C96-40F7-839E-7350508D4F33}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A70E29B3-9C96-40F7-839E-7350508D4F33}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
- {A70E29B3-9C96-40F7-839E-7350508D4F33}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A70E29B3-9C96-40F7-839E-7350508D4F33}.Release|Any CPU.Build.0 = Release|Any CPU
- {E260CC6D-1695-43AA-918A-B5EF4049A3E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {E260CC6D-1695-43AA-918A-B5EF4049A3E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {E260CC6D-1695-43AA-918A-B5EF4049A3E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {E260CC6D-1695-43AA-918A-B5EF4049A3E9}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {F27E00AF-AB53-4F7B-B80B-85A22DE6E7A6}
- EndGlobalSection
-EndGlobal
diff --git a/src/ClientApp/Controls/AddBasketButton.xaml b/src/ClientApp/Controls/AddBasketButton.xaml
deleted file mode 100644
index d33766632..000000000
--- a/src/ClientApp/Controls/AddBasketButton.xaml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ClientApp/Controls/AddBasketButton.xaml.cs b/src/ClientApp/Controls/AddBasketButton.xaml.cs
deleted file mode 100644
index 90dd72c00..000000000
--- a/src/ClientApp/Controls/AddBasketButton.xaml.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace eShop.ClientApp.Controls;
-
-public partial class AddBasketButton : Grid
-{
- public AddBasketButton()
- {
- InitializeComponent();
- }
-}
diff --git a/src/ClientApp/Controls/CustomTabbedPage.cs b/src/ClientApp/Controls/CustomTabbedPage.cs
deleted file mode 100644
index b0e90441b..000000000
--- a/src/ClientApp/Controls/CustomTabbedPage.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-namespace eShop.ClientApp.Controls;
-
-public class CustomTabbedPage : TabbedPage
-{
- public static BindableProperty BadgeTextProperty =
- BindableProperty.CreateAttached("BadgeText", typeof(string), typeof(CustomTabbedPage), default(string));
-
- public static BindableProperty BadgeColorProperty =
- BindableProperty.CreateAttached("BadgeColor", typeof(Color), typeof(CustomTabbedPage), Colors.Transparent);
-
- public static string GetBadgeText(BindableObject view)
- {
- return (string)view.GetValue(BadgeTextProperty);
- }
-
- public static void SetBadgeText(BindableObject view, string value)
- {
- view.SetValue(BadgeTextProperty, value);
- }
-
- public static Color GetBadgeColor(BindableObject view)
- {
- return (Color)view.GetValue(BadgeColorProperty);
- }
-
- public static void SetBadgeColor(BindableObject view, Color value)
- {
- view.SetValue(BadgeColorProperty, value);
- }
-}
diff --git a/src/ClientApp/Controls/ToggleButton.cs b/src/ClientApp/Controls/ToggleButton.cs
deleted file mode 100644
index a1ea8d97a..000000000
--- a/src/ClientApp/Controls/ToggleButton.cs
+++ /dev/null
@@ -1,122 +0,0 @@
-using System.Windows.Input;
-
-namespace eShop.ClientApp.Controls;
-
-public class ToggleButton : ContentView
-{
- public static readonly BindableProperty CommandProperty =
- BindableProperty.Create(nameof(Command), typeof(ICommand), typeof(ToggleButton));
-
- public static readonly BindableProperty CommandParameterProperty =
- BindableProperty.Create(nameof(CommandParameter), typeof(object), typeof(ToggleButton));
-
- public static readonly BindableProperty CheckedProperty =
- BindableProperty.Create(nameof(Checked), typeof(bool), typeof(ToggleButton), false, BindingMode.TwoWay,
- propertyChanged: OnCheckedChanged);
-
- public static readonly BindableProperty AnimateProperty =
- BindableProperty.Create(nameof(Animate), typeof(bool), typeof(ToggleButton), false);
-
- public static readonly BindableProperty CheckedImageProperty =
- BindableProperty.Create(nameof(CheckedImage), typeof(ImageSource), typeof(ToggleButton));
-
- public static readonly BindableProperty UnCheckedImageProperty =
- BindableProperty.Create(nameof(UnCheckedImage), typeof(ImageSource), typeof(ToggleButton));
-
- private ICommand _toggleCommand;
- private Image _toggleImage;
-
- public ToggleButton()
- {
- Initialize();
- }
-
- public ICommand Command
- {
- get => (ICommand)GetValue(CommandProperty);
- set => SetValue(CommandProperty, value);
- }
-
- public object CommandParameter
- {
- get => GetValue(CommandParameterProperty);
- set => SetValue(CommandParameterProperty, value);
- }
-
- public bool Checked
- {
- get => (bool)GetValue(CheckedProperty);
- set => SetValue(CheckedProperty, value);
- }
-
- public bool Animate
- {
- get => (bool)GetValue(AnimateProperty);
- set => SetValue(CheckedProperty, value);
- }
-
- public ImageSource CheckedImage
- {
- get => (ImageSource)GetValue(CheckedImageProperty);
- set => SetValue(CheckedImageProperty, value);
- }
-
- public ImageSource UnCheckedImage
- {
- get => (ImageSource)GetValue(UnCheckedImageProperty);
- set => SetValue(UnCheckedImageProperty, value);
- }
-
- public ICommand ToggleCommand =>
- _toggleCommand ??= new Command(() =>
- {
- Checked = !Checked;
-
- if (Command != null)
- {
- Command.Execute(CommandParameter);
- }
- });
-
- private void Initialize()
- {
- _toggleImage = new Image();
-
- Animate = true;
-
- GestureRecognizers.Add(new TapGestureRecognizer {Command = ToggleCommand});
-
- _toggleImage.Source = UnCheckedImage;
- Content = _toggleImage;
- }
-
- protected override void OnParentSet()
- {
- base.OnParentSet();
- _toggleImage.Source = UnCheckedImage;
- Content = _toggleImage;
- }
-
- private static async void OnCheckedChanged(BindableObject bindable, object oldValue, object newValue)
- {
- var toggleButton = (ToggleButton)bindable;
-
- if (Equals(newValue, null) && !Equals(oldValue, null))
- {
- return;
- }
-
- toggleButton._toggleImage.Source = toggleButton.Checked
- ? toggleButton.CheckedImage
- : toggleButton.UnCheckedImage;
-
- toggleButton.Content = toggleButton._toggleImage;
-
- if (toggleButton.Animate)
- {
- await toggleButton.ScaleTo(0.9, 50, Easing.Linear);
- await Task.Delay(100);
- await toggleButton.ScaleTo(1, 50, Easing.Linear);
- }
- }
-}
diff --git a/src/ClientApp/Converters/DoesNotHaveCountConverter.cs b/src/ClientApp/Converters/DoesNotHaveCountConverter.cs
deleted file mode 100644
index 88faa80ef..000000000
--- a/src/ClientApp/Converters/DoesNotHaveCountConverter.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System.Globalization;
-using CommunityToolkit.Maui.Converters;
-
-namespace eShop.ClientApp.Converters;
-
-public class DoesNotHaveCountConverter : BaseConverterOneWay
-{
- public override bool DefaultConvertReturnValue { get; set; } = false;
-
- public override bool ConvertFrom(int value, CultureInfo culture)
- {
- return value <= 0;
- }
-}
diff --git a/src/ClientApp/Converters/DoubleConverter.cs b/src/ClientApp/Converters/DoubleConverter.cs
deleted file mode 100644
index d97c217a8..000000000
--- a/src/ClientApp/Converters/DoubleConverter.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System.Globalization;
-using CommunityToolkit.Maui.Converters;
-
-namespace eShop.ClientApp.Converters;
-
-public class DoubleConverter : BaseConverter
-{
- public override string DefaultConvertReturnValue { get; set; } = string.Empty;
- public override double DefaultConvertBackReturnValue { get; set; } = 0d;
-
- public override double ConvertBackTo(string value, CultureInfo culture)
- {
- return double.TryParse(value, out var parsed) ? parsed : DefaultConvertBackReturnValue;
- }
-
- public override string ConvertFrom(double value, CultureInfo culture)
- {
- return value.ToString();
- }
-}
diff --git a/src/ClientApp/Converters/FirstValidationErrorConverter.cs b/src/ClientApp/Converters/FirstValidationErrorConverter.cs
deleted file mode 100644
index bf1e76110..000000000
--- a/src/ClientApp/Converters/FirstValidationErrorConverter.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System.Globalization;
-using CommunityToolkit.Maui.Converters;
-
-namespace eShop.ClientApp.Converters;
-
-public class FirstValidationErrorConverter : BaseConverterOneWay, string>
-{
- public override string DefaultConvertReturnValue { get; set; } = string.Empty;
-
- public override string ConvertFrom(IEnumerable value, CultureInfo culture)
- {
- return value?.FirstOrDefault() ?? DefaultConvertReturnValue;
- }
-}
diff --git a/src/ClientApp/Converters/HasCountConverter.cs b/src/ClientApp/Converters/HasCountConverter.cs
deleted file mode 100644
index 79cf92ace..000000000
--- a/src/ClientApp/Converters/HasCountConverter.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System.Globalization;
-using CommunityToolkit.Maui.Converters;
-
-namespace eShop.ClientApp.Converters;
-
-public class HasCountConverter : BaseConverterOneWay
-{
- public override bool DefaultConvertReturnValue { get; set; } = false;
-
- public override bool ConvertFrom(int value, CultureInfo culture)
- {
- return value > 0;
- }
-}
diff --git a/src/ClientApp/Converters/ItemsToHeightConverter.cs b/src/ClientApp/Converters/ItemsToHeightConverter.cs
deleted file mode 100644
index 543394824..000000000
--- a/src/ClientApp/Converters/ItemsToHeightConverter.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System.Globalization;
-using CommunityToolkit.Maui.Converters;
-
-namespace eShop.ClientApp.Converters;
-
-public class ItemsToHeightConverter : BaseConverterOneWay
-{
- private const int ItemHeight = 156;
-
- public override int DefaultConvertReturnValue { get; set; } = ItemHeight;
-
- public override int ConvertFrom(int value, CultureInfo culture)
- {
- return value * ItemHeight;
- }
-}
diff --git a/src/ClientApp/Converters/WebNavigatedEventArgsConverter.cs b/src/ClientApp/Converters/WebNavigatedEventArgsConverter.cs
deleted file mode 100644
index 1850ee91b..000000000
--- a/src/ClientApp/Converters/WebNavigatedEventArgsConverter.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System.Globalization;
-using CommunityToolkit.Maui.Converters;
-
-namespace eShop.ClientApp.Converters;
-
-public class WebNavigatedEventArgsConverter : BaseConverterOneWay
-{
- public override string DefaultConvertReturnValue { get; set; } = string.Empty;
-
- public override string ConvertFrom(WebNavigatedEventArgs value, CultureInfo culture)
- {
- return value?.Url ?? string.Empty;
- }
-}
diff --git a/src/ClientApp/Converters/WebNavigatingEventArgsConverter.cs b/src/ClientApp/Converters/WebNavigatingEventArgsConverter.cs
deleted file mode 100644
index 05b5b2cf3..000000000
--- a/src/ClientApp/Converters/WebNavigatingEventArgsConverter.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.Globalization;
-using Microsoft.Maui.Controls;
-
-namespace eShop.ClientApp.Converters;
-
-public class WebNavigatingEventArgsConverter : IValueConverter
-{
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value is WebNavigatingEventArgs eventArgs)
- {
- return eventArgs.Url ?? string.Empty;
- }
-
- return string.Empty;
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException("ConvertBack is not supported for WebNavigatingEventArgsConverter.");
- }
-}
diff --git a/src/ClientApp/Effects/EntryLineColorEffect.cs b/src/ClientApp/Effects/EntryLineColorEffect.cs
deleted file mode 100644
index de1e79c10..000000000
--- a/src/ClientApp/Effects/EntryLineColorEffect.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace eShop.ClientApp.Effects;
-
-public class EntryLineColorEffect : RoutingEffect
-{
- public EntryLineColorEffect()
- : base("ClientApp.EntryLineColorEffect")
- {
- }
-}
diff --git a/src/ClientApp/Effects/ThemeEffects.cs b/src/ClientApp/Effects/ThemeEffects.cs
deleted file mode 100644
index e0b3978ce..000000000
--- a/src/ClientApp/Effects/ThemeEffects.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-namespace eShop.ClientApp.Effects;
-
-public static class ThemeEffects
-{
- public static readonly BindableProperty CircleProperty =
- BindableProperty.CreateAttached("Circle", typeof(bool), typeof(ThemeEffects), false,
- propertyChanged: OnChanged);
-
- public static bool GetCircle(BindableObject view)
- {
- return (bool)view.GetValue(CircleProperty);
- }
-
- public static void SetCircle(BindableObject view, bool circle)
- {
- view.SetValue(CircleProperty, circle);
- }
-
-
- private static void OnChanged(BindableObject bindable, object oldValue, object newValue)
- where TEffect : Effect, new()
- {
- if (bindable is not View view)
- {
- return;
- }
-
- if (Equals(newValue, default(TProp)))
- {
- var toRemove = view.Effects.FirstOrDefault(e => e is TEffect);
- if (toRemove != null)
- {
- view.Effects.Remove(toRemove);
- }
- }
- else
- {
- view.Effects.Add(new TEffect());
- }
- }
-
- private class CircleEffect : RoutingEffect
- {
- public CircleEffect()
- : base("ClientApp.CircleEffect")
- {
- }
- }
-}
diff --git a/src/ClientApp/Exceptions/ServiceAuthenticationException.cs b/src/ClientApp/Exceptions/ServiceAuthenticationException.cs
deleted file mode 100644
index 1c10e21c4..000000000
--- a/src/ClientApp/Exceptions/ServiceAuthenticationException.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace eShop.ClientApp.Exceptions;
-
-public class ServiceAuthenticationException : Exception
-{
- public ServiceAuthenticationException()
- {
- }
-
- public ServiceAuthenticationException(string content)
- {
- Content = content;
- }
-
- public string Content { get; }
-}
diff --git a/src/ClientApp/Extensions/DictionaryExtensions.cs b/src/ClientApp/Extensions/DictionaryExtensions.cs
deleted file mode 100644
index 0c3a87bb4..000000000
--- a/src/ClientApp/Extensions/DictionaryExtensions.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-namespace eShop.ClientApp;
-
-public static class DictionaryExtensions
-{
- public static bool ValueAsBool(this IDictionary dictionary, string key, bool defaultValue = false)
- {
- return dictionary.ContainsKey(key) && dictionary[key] is bool dictValue
- ? dictValue
- : defaultValue;
- }
-
- public static int ValueAsInt(this IDictionary dictionary, string key, int defaultValue = 0)
- {
- return dictionary.ContainsKey(key) && dictionary[key] is int intValue
- ? intValue
- : defaultValue;
- }
-
- public static T ValueAs(this IDictionary dictionary, string key, T defaultValue = default)
- {
- return dictionary.ContainsKey(key) && dictionary[key] is T value
- ? value
- : defaultValue;
- }
-}
diff --git a/src/ClientApp/Extensions/ICommandExtensions.cs b/src/ClientApp/Extensions/ICommandExtensions.cs
deleted file mode 100644
index 5a6f02636..000000000
--- a/src/ClientApp/Extensions/ICommandExtensions.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Windows.Input;
-
-namespace eShop.ClientApp;
-
-public static class ICommandExtensions
-{
- public static void AttemptNotifyCanExecuteChanged(this TCommand command)
- where TCommand : ICommand
- {
- if (command is IRelayCommand rc)
- {
- rc?.NotifyCanExecuteChanged();
- }
- }
-}
diff --git a/src/ClientApp/Extensions/VisualElementExtensions.cs b/src/ClientApp/Extensions/VisualElementExtensions.cs
deleted file mode 100644
index a0442f61a..000000000
--- a/src/ClientApp/Extensions/VisualElementExtensions.cs
+++ /dev/null
@@ -1,399 +0,0 @@
-using System.Linq.Expressions;
-using System.Reflection;
-
-namespace eShop.ClientApp;
-
-public static class VisualElementExtensions
-{
- ///
- /// Extends VisualElement with a new ColorTo method which provides a higher level approach for animating an elements
- /// color.
- ///
- /// A task containing the animation result boolean.
- /// VisualElement to process.
- /// Expression.
- /// end color.
- /// The time, in milliseconds, between frames.
- /// The number of milliseconds over which to interpolate the animation.
- /// The easing function to use to transition in, out, or in and out of the animation.
- /// The 1st type parameter.
- public static Task ColorTo(this TElement element, Expression> start,
- Color end, uint rate = 16, uint length = 250, Easing easing = null)
- where TElement : IAnimatable
- {
- if (element is null)
- {
- return Task.FromResult(false);
- }
-
- easing ??= Easing.Linear;
-
- var member = (MemberExpression)start.Body;
- var property = member.Member as PropertyInfo;
-
- var animationName = $"color_to_{property.Name}_{element.GetHashCode()}";
-
- var tcs = new TaskCompletionSource();
-
- var elementStartingColor = (Color)property.GetValue(element);
-
- var transitionAnimation =
- new Animation(d => property.SetValue(element, elementStartingColor.Lerp(end, (float)d)), 0d, 1d, easing);
-
- try
- {
- element.AbortAnimation(animationName);
-
- transitionAnimation.Commit(element, animationName, rate, length, finished: (f, a) => tcs.SetResult(a));
- }
- catch (InvalidOperationException)
- {
- }
-
- return tcs.Task;
- }
-
- ///
- /// Extends VisualElement with a new SizeTo method which provides a higher level approach for animating transitions.
- ///
- /// A task containing the animation result boolean.
- /// The VisualElement to perform animation on.
- /// The animation starting point.
- /// The animation ending point.
- /// The time, in milliseconds, between frames.
- /// The number of milliseconds over which to interpolate the animation.
- /// The easing function to use to transition in, out, or in and out of the animation.
- /// The 1st type parameter.
- public static Task TransitionTo(this TElement element, Expression> start,
- double end, uint rate = 16, uint length = 250, Easing easing = null)
- where TElement : IAnimatable
- {
- if (element is null)
- {
- return Task.FromResult(false);
- }
-
- easing ??= Easing.Linear;
-
- var member = (MemberExpression)start.Body;
- var property = member.Member as PropertyInfo;
-
- var animationName = $"transition_to_{property.Name}_{element.GetHashCode()}";
-
- var tcs = new TaskCompletionSource();
-
- var elementStartingPosition = (double)property.GetValue(element);
-
- var transitionAnimation =
- new Animation(d => property.SetValue(element, d), elementStartingPosition, end, easing);
-
- try
- {
- element.AbortAnimation(animationName);
-
- transitionAnimation.Commit(element, animationName, rate, length, finished: (f, a) => tcs.SetResult(a));
- }
- catch (InvalidOperationException)
- {
- }
-
- return tcs.Task;
- }
-
- ///
- /// Extends VisualElement with a new SizeTo method which provides a higher level approach for animating transitions.
- ///
- /// A task containing the animation result boolean.
- /// The VisualElement to perform animation on.
- /// The animation starting point.
- /// The animation ending point.
- /// The time, in milliseconds, between frames.
- /// The number of milliseconds over which to interpolate the animation.
- /// The easing function to use to transition in, out, or in and out of the animation.
- /// The 1st type parameter.
- public static Task TransitionTo(this TElement element, Expression> start,
- float end, uint rate = 16, uint length = 250, Easing easing = null)
- where TElement : IAnimatable
- {
- if (element is null)
- {
- return Task.FromResult(false);
- }
-
- easing ??= Easing.Linear;
-
- var member = (MemberExpression)start.Body;
- var property = member.Member as PropertyInfo;
-
- var animationName = $"transition_to_{property.Name}_{element.GetHashCode()}";
-
- var tcs = new TaskCompletionSource();
-
- var elementStartingPosition = (float)property.GetValue(element);
-
- var transitionAnimation =
- new Animation(d => property.SetValue(element, d), elementStartingPosition, end, easing);
-
- try
- {
- element.AbortAnimation(animationName);
-
- transitionAnimation.Commit(element, animationName, rate, length, finished: (f, a) => tcs.SetResult(a));
- }
- catch (InvalidOperationException)
- {
- }
-
- return tcs.Task;
- }
-
- ///
- /// Extends VisualElement with a new SizeTo method which provides a higher level approach for animating transitions.
- ///
- /// A task containing the animation result boolean.
- /// The VisualElement to perform animation on.
- /// The animation starting point.
- /// The animation ending point.
- /// The time, in milliseconds, between frames.
- /// The number of milliseconds over which to interpolate the animation.
- /// The easing function to use to transition in, out, or in and out of the animation.
- /// The 1st type parameter.
- public static Task TransitionTo(this TElement element, Expression> start,
- int end, uint rate = 16, uint length = 250, Easing easing = null)
- where TElement : IAnimatable
- {
- if (element is null)
- {
- return Task.FromResult(false);
- }
-
- easing ??= Easing.Linear;
-
- var member = (MemberExpression)start.Body;
- var property = member.Member as PropertyInfo;
-
- var animationName = $"transition_to_{property.Name}_{element.GetHashCode()}";
-
- var tcs = new TaskCompletionSource();
-
- var elementStartingPosition = (int)property.GetValue(element);
-
- var transitionAnimation =
- new Animation(d => property.SetValue(element, (int)d), elementStartingPosition, end, easing);
-
- try
- {
- element.AbortAnimation(animationName);
-
- transitionAnimation.Commit(element, animationName, rate, length, finished: (f, a) => tcs.SetResult(a));
- }
- catch (InvalidOperationException)
- {
- }
-
- return tcs.Task;
- }
-
- public static Task TransitionTo(this TElement element, Expression> start,
- uint end, uint rate = 16, uint length = 250, Easing easing = null)
- where TElement : IAnimatable
- {
- if (element is null)
- {
- return Task.FromResult(false);
- }
-
- easing ??= Easing.Linear;
-
- var member = (MemberExpression)start.Body;
- var property = member.Member as PropertyInfo;
-
- var animationName = $"transition_to_{property.Name}_{element.GetHashCode()}";
-
- var tcs = new TaskCompletionSource();
-
- var elementStartingPosition = (uint)property.GetValue(element);
-
- var transitionAnimation =
- new Animation(d => property.SetValue(element, (uint)d), elementStartingPosition, end, easing);
-
- try
- {
- element.AbortAnimation(animationName);
-
- transitionAnimation.Commit(element, animationName, rate, length, finished: (f, a) => tcs.SetResult(a));
- }
- catch (InvalidOperationException)
- {
- }
-
- return tcs.Task;
- }
-
- public static Task TransitionTo(this TElement element, string animationName,
- Action callback, Func start, double end, uint rate = 16, uint length = 250,
- Easing easing = null)
- where TElement : IAnimatable
- {
- if (element is null)
- {
- return Task.FromResult(false);
- }
-
- easing ??= Easing.Linear;
-
- var tcs = new TaskCompletionSource();
-
- var transitionAnimation = new Animation(callback, start?.Invoke() ?? default(double), end, easing);
-
- try
- {
- element.AbortAnimation(animationName);
-
- transitionAnimation.Commit(element, animationName, rate, length, finished: (f, a) => tcs.SetResult(a));
- }
- catch (InvalidOperationException)
- {
- }
-
- return tcs.Task;
- }
-
- public static Task TransitionTo(this TElement element, string animationName, Action callback,
- Func start, float end, uint rate = 16, uint length = 250, Easing easing = null)
- where TElement : IAnimatable
- {
- if (element is null)
- {
- return Task.FromResult(false);
- }
-
- easing ??= Easing.Linear;
-
- var tcs = new TaskCompletionSource();
-
- var transitionAnimation =
- new Animation(x => callback((float)x), start?.Invoke() ?? default(float), end, easing);
-
- try
- {
- element.AbortAnimation(animationName);
-
- transitionAnimation.Commit(element, animationName, rate, length, finished: (f, a) => tcs.SetResult(a));
- }
- catch (InvalidOperationException)
- {
- }
-
- return tcs.Task;
- }
-
- public static Task TransitionTo(this TElement element, string animationName,
- Action callback, double start, double end, uint rate = 16, uint length = 250, Easing easing = null)
- where TElement : IAnimatable
- {
- if (element is null)
- {
- return Task.FromResult(false);
- }
-
- easing ??= Easing.Linear;
-
- var tcs = new TaskCompletionSource();
-
- var transitionAnimation = new Animation(callback, start, end, easing);
-
- try
- {
- element.AbortAnimation(animationName);
-
- transitionAnimation.Commit(element, animationName, rate, length, finished: (f, a) => tcs.SetResult(a));
- }
- catch (InvalidOperationException)
- {
- }
-
- return tcs.Task;
- }
-
- public static Task TransitionTo(this TElement element, string animationName, Action callback,
- Func start, int end, uint rate = 16, uint length = 250, Easing easing = null)
- where TElement : IAnimatable
- {
- if (element is null)
- {
- return Task.FromResult(false);
- }
-
- easing ??= Easing.Linear;
-
- var tcs = new TaskCompletionSource();
-
- var transitionAnimation = new Animation(x => callback((int)x), start?.Invoke() ?? default(int), end, easing);
-
- try
- {
- element.AbortAnimation(animationName);
-
- transitionAnimation.Commit(element, animationName, rate, length, finished: (f, a) => tcs.SetResult(a));
- }
- catch (InvalidOperationException)
- {
- }
-
- return tcs.Task;
- }
-
- ///
- /// Lerp the specified color, to and amount.
- ///
- /// The lerp.
- /// Color to calculate from.
- /// Color to calculate to.
- /// Amount of transition to apply.
- public static Color Lerp(this Color color, Color to, float amount)
- {
- return
- Color.FromRgba(
- color.Red.Lerp(to.Red, amount),
- color.Green.Lerp(to.Green, amount),
- color.Blue.Lerp(to.Blue, amount),
- color.Alpha.Lerp(to.Alpha, amount));
- }
-
- ///
- /// Lerp the specified start, end and amount.
- ///
- /// The lerp.
- /// Start.
- /// End.
- /// Amount.
- public static double Lerp(this double start, double end, double amount)
- {
- var difference = end - start;
- var adjusted = difference * amount;
- return start + adjusted;
- }
-
- public static float Lerp(this float start, float end, float amount)
- {
- var difference = end - start;
- var adjusted = difference * amount;
- return start + adjusted;
- }
-
- public static int Lerp(this int start, int end, double amount)
- {
- var difference = end - start;
- var adjusted = (int)(difference * amount);
- return start + adjusted;
- }
-
- public static byte Lerp(this byte start, byte end, double amount)
- {
- var difference = end - start;
- var adjusted = (int)(difference * amount);
-
- return (byte)(start + adjusted);
- }
-}
diff --git a/src/ClientApp/GlobalSuppressions.cs b/src/ClientApp/GlobalSuppressions.cs
deleted file mode 100644
index dbf270233..000000000
--- a/src/ClientApp/GlobalSuppressions.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// This file is used by Code Analysis to maintain SuppressMessage
-// attributes that are applied to this project.
-// Project-level suppressions either have no target or are given
-// a specific target and scoped to a namespace, type, member, etc.
-
-using System.Diagnostics.CodeAnalysis;
-
-[assembly: SuppressMessage(
- "Interoperability",
- "CA1416:Validate platform compatibility",
- Justification = "Using latest Microsoft MAUI components",
- Scope = "module")]
diff --git a/src/ClientApp/GlobalUsings.cs b/src/ClientApp/GlobalUsings.cs
deleted file mode 100644
index 685e92823..000000000
--- a/src/ClientApp/GlobalUsings.cs
+++ /dev/null
@@ -1,3 +0,0 @@
-global using eShop.ClientApp.ViewModels;
-global using CommunityToolkit.Mvvm.ComponentModel;
-global using CommunityToolkit.Mvvm.Input;
diff --git a/src/ClientApp/Helpers/EasingHelper.cs b/src/ClientApp/Helpers/EasingHelper.cs
deleted file mode 100644
index e1594d43b..000000000
--- a/src/ClientApp/Helpers/EasingHelper.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using eShop.ClientApp.Animations.Base;
-
-namespace eShop.ClientApp.Helpers;
-
-public static class EasingHelper
-{
- public static Easing GetEasing(EasingType type)
- {
- return type switch
- {
- EasingType.BounceIn => Easing.BounceIn,
- EasingType.BounceOut => Easing.BounceOut,
- EasingType.CubicIn => Easing.CubicIn,
- EasingType.CubicInOut => Easing.CubicInOut,
- EasingType.CubicOut => Easing.CubicOut,
- EasingType.Linear => Easing.Linear,
- EasingType.SinIn => Easing.SinIn,
- EasingType.SinInOut => Easing.SinInOut,
- EasingType.SinOut => Easing.SinOut,
- EasingType.SpringIn => Easing.SpringIn,
- EasingType.SpringOut => Easing.SpringOut,
- _ => null
- };
- }
-}
diff --git a/src/ClientApp/Helpers/UriHelper.cs b/src/ClientApp/Helpers/UriHelper.cs
deleted file mode 100644
index 96c6261ad..000000000
--- a/src/ClientApp/Helpers/UriHelper.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-namespace eShop.ClientApp.Helpers;
-
-public static class UriHelper
-{
- private static readonly char[] _trims = {'\\', '/'};
- public static string CombineUri(params string[] uriParts)
- {
- var uri = string.Empty;
-
- if (uriParts != null && uriParts.Length > 0)
- {
- uri = (uriParts[0] ?? string.Empty).TrimEnd(_trims);
- for (var i = 1; i < uriParts.Length; i++)
- {
- uri = $"{uri.TrimEnd(_trims)}/{(uriParts[i] ?? string.Empty).TrimStart(_trims)}";
- }
- }
-
- return uri;
- }
-}
diff --git a/src/ClientApp/MauiProgram.cs b/src/ClientApp/MauiProgram.cs
deleted file mode 100644
index 88f6fabc9..000000000
--- a/src/ClientApp/MauiProgram.cs
+++ /dev/null
@@ -1,185 +0,0 @@
-using CommunityToolkit.Maui;
-using eShop.ClientApp.Services;
-using eShop.ClientApp.Services.AppEnvironment;
-using eShop.ClientApp.Services.Basket;
-using eShop.ClientApp.Services.Catalog;
-using eShop.ClientApp.Services.FixUri;
-using eShop.ClientApp.Services.Identity;
-using eShop.ClientApp.Services.Location;
-using eShop.ClientApp.Services.OpenUrl;
-using eShop.ClientApp.Services.Order;
-using eShop.ClientApp.Services.RequestProvider;
-using eShop.ClientApp.Services.Settings;
-using eShop.ClientApp.Services.Theme;
-using eShop.ClientApp.Views;
-using IdentityModel.OidcClient;
-using Microsoft.Extensions.DependencyInjection.Extensions;
-using Microsoft.Extensions.Logging;
-using IBrowser = IdentityModel.OidcClient.Browser.IBrowser;
-
-namespace eShop.ClientApp;
-
-public static class MauiProgram
-{
- public static MauiApp CreateMauiApp()
- {
- return MauiApp
- .CreateBuilder()
- .UseMauiApp()
- .ConfigureEffects(
- effects =>
- {
- })
- .UseMauiCommunityToolkit()
- .ConfigureFonts(
- fonts =>
- {
- fonts.AddFont("FontAwesomeRegular.otf", "FontAwesome-Regular");
- fonts.AddFont("FontAwesomeSolid.otf", "FontAwesome-Solid");
- fonts.AddFont("Montserrat-Bold.ttf", "Montserrat-Bold");
- fonts.AddFont("Montserrat-Regular.ttf", "Montserrat-Regular");
- })
- .ConfigureEssentials(
- essentials =>
- {
- essentials
- .AddAppAction(AppActions.ViewProfileAction)
- .OnAppAction(App.HandleAppActions);
- })
-#if !WINDOWS
- .UseMauiMaps()
-#endif
- .ConfigureHandlers()
- .RegisterAppServices()
- .RegisterViewModels()
- .RegisterViews()
- .Build();
- }
-
- public static MauiAppBuilder ConfigureHandlers(this MauiAppBuilder mauiAppBuilder)
- {
-#if IOS || MACCATALYST
- mauiAppBuilder.ConfigureMauiHandlers(handlers =>
- {
- handlers.AddHandler();
- handlers.AddHandler();
- });
-#endif
-
- return mauiAppBuilder;
- }
-
- public static MauiAppBuilder RegisterAppServices(this MauiAppBuilder mauiAppBuilder)
- {
- mauiAppBuilder.Services.AddSingleton();
- mauiAppBuilder.Services.AddSingleton();
- mauiAppBuilder.Services.AddSingleton();
- mauiAppBuilder.Services.AddSingleton();
- mauiAppBuilder.Services.AddSingleton(
- sp =>
- {
- var debugHttpHandler = sp.GetKeyedService("DebugHttpMessageHandler");
- return new RequestProvider(debugHttpHandler);
- });
- mauiAppBuilder.Services.AddSingleton(
- sp =>
- {
- var browser = sp.GetRequiredService();
- var settingsService = sp.GetRequiredService();
- var debugHttpHandler = sp.GetKeyedService("DebugHttpMessageHandler");
- return new IdentityService(browser, settingsService, debugHttpHandler);
- });
- mauiAppBuilder.Services.AddSingleton();
- mauiAppBuilder.Services.AddSingleton();
-
- mauiAppBuilder.Services.AddSingleton();
-
- mauiAppBuilder.Services.AddSingleton(
- serviceProvider =>
- {
- var requestProvider = serviceProvider.GetRequiredService();
- var fixUriService = serviceProvider.GetRequiredService();
- var settingsService = serviceProvider.GetRequiredService();
- var identityService = serviceProvider.GetRequiredService();
-
- var aes =
- new AppEnvironmentService(
- new BasketMockService(), new BasketService(identityService, settingsService, fixUriService),
- new CatalogMockService(), new CatalogService(settingsService, requestProvider, fixUriService),
- new OrderMockService(), new OrderService(identityService, settingsService, requestProvider),
- new IdentityMockService(), identityService);
-
- aes.UpdateDependencies(settingsService.UseMocks);
- return aes;
- });
-
- mauiAppBuilder.Services.AddTransient();
-
-#if DEBUG
- mauiAppBuilder.Services.AddKeyedSingleton(
- "DebugHttpMessageHandler",
- (sp, key) =>
- {
-#if ANDROID
- var handler = new Xamarin.Android.Net.AndroidMessageHandler();
- handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) =>
- {
- if (cert != null && cert.Issuer.Equals("CN=localhost", StringComparison.OrdinalIgnoreCase))
- {
- return true;
- }
-
- return errors == System.Net.Security.SslPolicyErrors.None;
- };
- return handler;
-#elif IOS || MACCATALYST
- var handler = new NSUrlSessionHandler
- {
- TrustOverrideForUrl = (sender, url, trust) => url.StartsWith("https://localhost", StringComparison.OrdinalIgnoreCase),
- };
- return handler;
-#else
- return null;
-#endif
- });
-
- mauiAppBuilder.Logging.AddDebug();
-#endif
-
- return mauiAppBuilder;
- }
-
- public static MauiAppBuilder RegisterViewModels(this MauiAppBuilder mauiAppBuilder)
- {
- mauiAppBuilder.Services.AddSingleton();
- mauiAppBuilder.Services.AddSingleton();
- mauiAppBuilder.Services.AddSingleton();
- mauiAppBuilder.Services.AddSingleton();
- mauiAppBuilder.Services.AddSingleton();
- mauiAppBuilder.Services.AddSingleton();
- mauiAppBuilder.Services.AddSingleton();
-
- mauiAppBuilder.Services.AddTransient();
- mauiAppBuilder.Services.AddTransient();
- mauiAppBuilder.Services.AddTransient();
-
- return mauiAppBuilder;
- }
-
- public static MauiAppBuilder RegisterViews(this MauiAppBuilder mauiAppBuilder)
- {
- mauiAppBuilder.Services.AddSingleton();
-
- mauiAppBuilder.Services.AddTransient();
- mauiAppBuilder.Services.AddTransient();
- mauiAppBuilder.Services.AddTransient();
- mauiAppBuilder.Services.AddTransient();
- mauiAppBuilder.Services.AddTransient();
- mauiAppBuilder.Services.AddTransient();
- mauiAppBuilder.Services.AddTransient();
- mauiAppBuilder.Services.AddTransient();
- mauiAppBuilder.Services.AddTransient();
-
- return mauiAppBuilder;
- }
-}
diff --git a/src/ClientApp/Messages/ProductCountChangedMessage.cs b/src/ClientApp/Messages/ProductCountChangedMessage.cs
deleted file mode 100644
index b0ce9a0a3..000000000
--- a/src/ClientApp/Messages/ProductCountChangedMessage.cs
+++ /dev/null
@@ -1,5 +0,0 @@
-using CommunityToolkit.Mvvm.Messaging.Messages;
-
-namespace eShop.ClientApp.Messages;
-
-public class ProductCountChangedMessage(int count) : ValueChangedMessage(count);
diff --git a/src/ClientApp/Models/Basket/BasketItem.cs b/src/ClientApp/Models/Basket/BasketItem.cs
deleted file mode 100644
index f7d0c0163..000000000
--- a/src/ClientApp/Models/Basket/BasketItem.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-namespace eShop.ClientApp.Models.Basket;
-
-public class BasketItem : BindableObject
-{
- private int _quantity;
-
- public string Id { get; set; }
-
- public int ProductId { get; set; }
-
- public string ProductName { get; set; }
-
- public decimal UnitPrice { get; set; }
-
- public decimal OldUnitPrice { get; set; }
-
- public bool HasNewPrice => OldUnitPrice != 0.0m;
-
- public int Quantity
- {
- get => _quantity;
- set
- {
- _quantity = value;
- OnPropertyChanged();
- }
- }
-
- public string PictureUrl { get; set; }
-
- public decimal Total => Quantity * UnitPrice;
-
- public override string ToString()
- {
- return $"Product Id: {ProductId}, Quantity: {Quantity}";
- }
-}
diff --git a/src/ClientApp/Models/Basket/CustomerBasket.cs b/src/ClientApp/Models/Basket/CustomerBasket.cs
deleted file mode 100644
index ccab66d51..000000000
--- a/src/ClientApp/Models/Basket/CustomerBasket.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-namespace eShop.ClientApp.Models.Basket;
-
-public class CustomerBasket
-{
- private readonly List _items = new();
- public string BuyerId { get; set; }
- public IReadOnlyList Items => _items;
-
- public int ItemCount => _items.Sum(x => x.Quantity);
-
- public void AddItemToBasket(BasketItem basketItem)
- {
- foreach (var item in _items)
- {
- if (item.ProductId == basketItem.ProductId)
- {
- item.Quantity++;
- return;
- }
- }
-
- _items.Add(basketItem);
- }
-
- public void RemoveItemFromBasket(BasketItem basketItem)
- {
- for (var i = _items.Count - 1; i >= 0; i--)
- {
- if (_items[i].ProductId == basketItem.ProductId)
- {
- _items.RemoveAt(i);
- return;
- }
- }
- }
-
- public void ClearBasket()
- {
- _items.Clear();
- }
-}
diff --git a/src/ClientApp/Models/Catalog/CatalogBrand.cs b/src/ClientApp/Models/Catalog/CatalogBrand.cs
deleted file mode 100644
index 7113d3396..000000000
--- a/src/ClientApp/Models/Catalog/CatalogBrand.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace eShop.ClientApp.Models.Catalog;
-
-public class CatalogBrand
-{
- public int Id { get; set; }
- public string Brand { get; set; }
-
- public override string ToString()
- {
- return Brand;
- }
-}
diff --git a/src/ClientApp/Models/Catalog/CatalogItem.cs b/src/ClientApp/Models/Catalog/CatalogItem.cs
deleted file mode 100644
index 9e23b60e7..000000000
--- a/src/ClientApp/Models/Catalog/CatalogItem.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace eShop.ClientApp.Models.Catalog;
-
-public class CatalogItem
-{
- public int Id { get; set; }
- public string Name { get; set; }
-
- public string Description { get; set; }
- public decimal Price { get; set; }
- public string PictureUri { get; set; }
- public int CatalogBrandId { get; set; }
- public CatalogBrand CatalogBrand { get; set; }
- public int CatalogTypeId { get; set; }
- public CatalogType CatalogType { get; set; }
-}
diff --git a/src/ClientApp/Models/Catalog/CatalogRoot.cs b/src/ClientApp/Models/Catalog/CatalogRoot.cs
deleted file mode 100644
index 936c2da04..000000000
--- a/src/ClientApp/Models/Catalog/CatalogRoot.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace eShop.ClientApp.Models.Catalog;
-
-public class CatalogRoot
-{
- public int PageIndex { get; set; }
- public int PageSize { get; set; }
- public int Count { get; set; }
- public List Data { get; set; }
-}
diff --git a/src/ClientApp/Models/Catalog/CatalogType.cs b/src/ClientApp/Models/Catalog/CatalogType.cs
deleted file mode 100644
index 6222f75a2..000000000
--- a/src/ClientApp/Models/Catalog/CatalogType.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace eShop.ClientApp.Models.Catalog;
-
-public class CatalogType
-{
- public int Id { get; set; }
- public string Type { get; set; }
-
- public override string ToString()
- {
- return Type;
- }
-}
diff --git a/src/ClientApp/Models/Location/GeolocationError.cs b/src/ClientApp/Models/Location/GeolocationError.cs
deleted file mode 100644
index 6b71e8f5d..000000000
--- a/src/ClientApp/Models/Location/GeolocationError.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace eShop.ClientApp.Models.Location;
-
-public enum GeolocationError
-{
- PositionUnavailable,
- Unauthorized
-}
diff --git a/src/ClientApp/Models/Location/GeolocationException.cs b/src/ClientApp/Models/Location/GeolocationException.cs
deleted file mode 100644
index 7e951e407..000000000
--- a/src/ClientApp/Models/Location/GeolocationException.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-namespace eShop.ClientApp.Models.Location;
-
-public class GeolocationException : Exception
-{
- public GeolocationException(GeolocationError error)
- : base("A geolocation error occurred: " + error)
- {
- if (!Enum.IsDefined(typeof(GeolocationError), error))
- {
- throw new ArgumentException("error is not a valid GeolocationError member", nameof(error));
- }
-
- Error = error;
- }
-
- public GeolocationException(GeolocationError error, Exception innerException)
- : base("A geolocation error occurred: " + error, innerException)
- {
- if (!Enum.IsDefined(typeof(GeolocationError), error))
- {
- throw new ArgumentException("error is not a valid GeolocationError member", nameof(error));
- }
-
- Error = error;
- }
-
- public GeolocationError Error { get; private set; }
-}
diff --git a/src/ClientApp/Models/Location/Location.cs b/src/ClientApp/Models/Location/Location.cs
deleted file mode 100644
index 821a82f07..000000000
--- a/src/ClientApp/Models/Location/Location.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace eShop.ClientApp.Models.Location;
-
-public class Location
-{
- public double Longitude { get; set; }
- public double Latitude { get; set; }
-}
diff --git a/src/ClientApp/Models/Location/Position.cs b/src/ClientApp/Models/Location/Position.cs
deleted file mode 100644
index 7e72e124d..000000000
--- a/src/ClientApp/Models/Location/Position.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-namespace eShop.ClientApp.Models.Location;
-
-public class Position
-{
- public Position()
- {
- }
-
- public Position(double latitude, double longitude)
- {
- Timestamp = DateTimeOffset.UtcNow;
- Latitude = latitude;
- Longitude = longitude;
- }
-
- public Position(Position position)
- {
- if (position == null)
- {
- throw new ArgumentNullException(nameof(position));
- }
-
- Timestamp = position.Timestamp;
- Latitude = position.Latitude;
- Longitude = position.Longitude;
- Altitude = position.Altitude;
- AltitudeAccuracy = position.AltitudeAccuracy;
- Accuracy = position.Accuracy;
- Heading = position.Heading;
- Speed = position.Speed;
- }
-
- public DateTimeOffset Timestamp { get; set; }
- public double Latitude { get; set; }
- public double Longitude { get; set; }
- public double Altitude { get; set; }
- public double Accuracy { get; set; }
- public double AltitudeAccuracy { get; set; }
- public double Heading { get; set; }
- public double Speed { get; set; }
-}
diff --git a/src/ClientApp/Models/Marketing/Campaign.cs b/src/ClientApp/Models/Marketing/Campaign.cs
deleted file mode 100644
index 0ddd41dac..000000000
--- a/src/ClientApp/Models/Marketing/Campaign.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-namespace eShop.ClientApp.Models.Marketing;
-
-public class Campaign
-{
- public int Id { get; set; }
-
- public string Name { get; set; }
-
- public string Description { get; set; }
-
- public DateTime From { get; set; }
-
- public DateTime To { get; set; }
-
- public string PictureUri { get; set; }
-}
diff --git a/src/ClientApp/Models/Marketing/CampaignItem.cs b/src/ClientApp/Models/Marketing/CampaignItem.cs
deleted file mode 100644
index dfbf7f498..000000000
--- a/src/ClientApp/Models/Marketing/CampaignItem.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-namespace eShop.ClientApp.Models.Marketing;
-
-public class CampaignItem
-{
- public int Id { get; set; }
-
- public string Name { get; set; }
-
- public string Description { get; set; }
-
- public DateTime From { get; set; }
-
- public DateTime To { get; set; }
-
- public string PictureUri { get; set; }
-
- public string DetailsUri { get; set; }
-}
diff --git a/src/ClientApp/Models/Marketing/CampaignRoot.cs b/src/ClientApp/Models/Marketing/CampaignRoot.cs
deleted file mode 100644
index fa5a9ac8e..000000000
--- a/src/ClientApp/Models/Marketing/CampaignRoot.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace eShop.ClientApp.Models.Marketing;
-
-public class CampaignRoot
-{
- public int PageIndex { get; set; }
- public int PageSize { get; set; }
- public int Count { get; set; }
- public List Data { get; set; }
-}
diff --git a/src/ClientApp/Models/Navigation/TabParameter.cs b/src/ClientApp/Models/Navigation/TabParameter.cs
deleted file mode 100644
index 969d56d7f..000000000
--- a/src/ClientApp/Models/Navigation/TabParameter.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace eShop.ClientApp.Models.Navigation;
-
-public class TabParameter
-{
- public int TabIndex { get; set; }
-}
diff --git a/src/ClientApp/Models/Orders/CancelOrderCommand.cs b/src/ClientApp/Models/Orders/CancelOrderCommand.cs
deleted file mode 100644
index f2b07c371..000000000
--- a/src/ClientApp/Models/Orders/CancelOrderCommand.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace eShop.ClientApp.Models.Orders;
-
-public class CancelOrderCommand
-{
- public CancelOrderCommand(int orderNumber)
- {
- OrderNumber = orderNumber;
- }
-
- public int OrderNumber { get; }
-}
diff --git a/src/ClientApp/Models/Orders/CardType.cs b/src/ClientApp/Models/Orders/CardType.cs
deleted file mode 100644
index 6534ffbc3..000000000
--- a/src/ClientApp/Models/Orders/CardType.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace eShop.ClientApp.Models.Orders;
-
-public class CardType
-{
- public int Id { get; set; }
- public string Name { get; set; }
-}
diff --git a/src/ClientApp/Models/Orders/Order.cs b/src/ClientApp/Models/Orders/Order.cs
deleted file mode 100644
index ab8a6fd4f..000000000
--- a/src/ClientApp/Models/Orders/Order.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-using System.Text.Json.Serialization;
-
-namespace eShop.ClientApp.Models.Orders;
-
-public class Order
-{
- public Order()
- {
- SequenceNumber = 1;
- OrderItems = new List();
- }
-
- [JsonPropertyName("userId")]
- public string UserId { get; set; }
-
- [JsonPropertyName("userName")]
- public string UserName { get; set; }
-
- public int SequenceNumber { get; set; }
-
- [JsonPropertyName("date")] public DateTime OrderDate { get; set; }
-
- [JsonPropertyName("status")] public string OrderStatus { get; set; }
-
- [JsonPropertyName("city")] public string ShippingCity { get; set; }
-
- [JsonPropertyName("street")] public string ShippingStreet { get; set; }
-
- [JsonPropertyName("state")] public string ShippingState { get; set; }
-
- [JsonPropertyName("country")] public string ShippingCountry { get; set; }
-
- [JsonPropertyName("zipCode")] public string ShippingZipCode { get; set; }
-
- public int CardTypeId { get; set; }
-
- public string CardNumber { get; set; }
-
- public string CardHolderName { get; set; }
-
- public DateTime CardExpiration { get; set; }
-
- public string CardSecurityNumber { get; set; }
-
- [JsonPropertyName("items")]
- public List OrderItems { get; set; }
-
- [JsonPropertyName("total")] public decimal Total { get; set; }
-
- [JsonPropertyName("ordernumber")] public int OrderNumber { get; set; }
-}
diff --git a/src/ClientApp/Models/Orders/OrderCheckout.cs b/src/ClientApp/Models/Orders/OrderCheckout.cs
deleted file mode 100644
index 344064e8d..000000000
--- a/src/ClientApp/Models/Orders/OrderCheckout.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System.ComponentModel.DataAnnotations;
-using eShop.ClientApp.Models.Orders;
-
-namespace eShop.ClientApp.Models.Basket;
-
-public class OrderCheckout
-{
- [Required]
- public string City { get; set; }
- [Required]
- public string Street { get; set; }
- [Required]
- public string State { get; set; }
- [Required]
- public string Country { get; set; }
-
- public string ZipCode { get; set; }
- [Required]
- public string CardNumber { get; set; }
- [Required]
- public string CardHolderName { get; set; }
-
- [Required]
- public DateTime CardExpiration { get; set; }
-
- [Required]
- public string CardSecurityNumber { get; set; }
-
- public int CardTypeId { get; set; }
-
- public string Buyer { get; set; }
-
- public IList Items { get; set; }
-
- [Required]
- public Guid RequestId { get; set; }
-}
diff --git a/src/ClientApp/Models/Orders/OrderItem.cs b/src/ClientApp/Models/Orders/OrderItem.cs
deleted file mode 100644
index e5bf56a15..000000000
--- a/src/ClientApp/Models/Orders/OrderItem.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System.Text.Json.Serialization;
-
-namespace eShop.ClientApp.Models.Orders;
-
-public class OrderItem
-{
- public long ProductId { get; set; }
-
- public Guid? OrderId { get; set; }
-
- [JsonPropertyName("unitprice")]
- public decimal UnitPrice { get; set; }
-
- [JsonPropertyName("productname")]
- public string ProductName { get; set; }
-
- [JsonPropertyName("pictureurl")]
- public string PictureUrl { get; set; }
-
- [JsonPropertyName("quantity")]
- public int Quantity { get; set; }
-
- public decimal Discount { get; set; }
- public decimal Total => Quantity * UnitPrice;
-
- public override string ToString()
- {
- return String.Format("Product Id: {0}, Quantity: {1}", ProductId, Quantity);
- }
-}
diff --git a/src/ClientApp/Models/Permissions/Permission.cs b/src/ClientApp/Models/Permissions/Permission.cs
deleted file mode 100644
index 618609fbd..000000000
--- a/src/ClientApp/Models/Permissions/Permission.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace eShop.ClientApp.Models.Permissions;
-
-public enum Permission
-{
- Unknown,
- Location,
- LocationAlways,
- LocationWhenInUse
-}
diff --git a/src/ClientApp/Models/Permissions/PermissionStatus.cs b/src/ClientApp/Models/Permissions/PermissionStatus.cs
deleted file mode 100644
index 4b6e146ef..000000000
--- a/src/ClientApp/Models/Permissions/PermissionStatus.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace eShop.ClientApp.Models.Permissions;
-
-public enum PermissionStatus
-{
- Denied,
- Disabled,
- Granted,
- Restricted,
- Unknown
-}
diff --git a/src/ClientApp/Models/Token/UserToken.cs b/src/ClientApp/Models/Token/UserToken.cs
deleted file mode 100644
index dd814b79c..000000000
--- a/src/ClientApp/Models/Token/UserToken.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System.Text.Json.Serialization;
-
-namespace eShop.ClientApp.Models.Token;
-
-public class UserToken
-{
- [JsonPropertyName("id_token")] public string IdToken { get; set; }
-
- [JsonPropertyName("access_token")] public string AccessToken { get; set; }
-
- [JsonPropertyName("refresh_token")]
- public string RefreshToken { get; set; }
-
- [JsonPropertyName("expires_at")]
- public DateTimeOffset ExpiresAt { get; set; }
-}
diff --git a/src/ClientApp/Models/User/Address.cs b/src/ClientApp/Models/User/Address.cs
deleted file mode 100644
index 0a5b6a808..000000000
--- a/src/ClientApp/Models/User/Address.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace eShop.ClientApp.Models.User;
-
-public class Address
-{
- public Guid Id { get; set; }
- public string Street { get; set; }
- public string City { get; set; }
- public string State { get; set; }
- public string StateCode { get; set; }
- public string Country { get; set; }
- public string CountryCode { get; set; }
- public string ZipCode { get; set; }
- public double Latitude { get; set; }
- public double Longitude { get; set; }
-}
diff --git a/src/ClientApp/Models/User/LogoutParameter.cs b/src/ClientApp/Models/User/LogoutParameter.cs
deleted file mode 100644
index 75ae41b36..000000000
--- a/src/ClientApp/Models/User/LogoutParameter.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace eShop.ClientApp.Models.User;
-
-public class LogoutParameter
-{
- public bool Logout { get; set; }
-}
diff --git a/src/ClientApp/Models/User/PaymentInfo.cs b/src/ClientApp/Models/User/PaymentInfo.cs
deleted file mode 100644
index f46841ac7..000000000
--- a/src/ClientApp/Models/User/PaymentInfo.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using eShop.ClientApp.Models.Orders;
-
-namespace eShop.ClientApp.Models.User;
-
-public class PaymentInfo
-{
- public Guid Id { get; set; }
- public string CardNumber { get; set; }
- public string SecurityNumber { get; set; }
- public int ExpirationMonth { get; set; }
- public int ExpirationYear { get; set; }
- public string CardHolderName { get; set; }
- public CardType CardType { get; set; }
- public string Expiration { get; set; }
-}
diff --git a/src/ClientApp/Models/User/UserInfo.cs b/src/ClientApp/Models/User/UserInfo.cs
deleted file mode 100644
index b98be38db..000000000
--- a/src/ClientApp/Models/User/UserInfo.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using System.Text.Json.Serialization;
-
-namespace eShop.ClientApp.Models.User;
-
-public class UserInfo
-{
- [JsonPropertyName("sub")] public string UserId { get; set; }
-
- [JsonPropertyName("preferred_username")]
- public string PreferredUsername { get; set; }
-
- [JsonPropertyName("name")] public string Name { get; set; }
-
- [JsonPropertyName("last_name")] public string LastName { get; set; }
-
- [JsonPropertyName("card_number")] public string CardNumber { get; set; }
-
- [JsonPropertyName("card_holder")] public string CardHolder { get; set; }
-
- [JsonPropertyName("card_security_number")]
- public string CardSecurityNumber { get; set; }
-
- [JsonPropertyName("address_city")] public string Address { get; set; }
-
- [JsonPropertyName("address_country")] public string Country { get; set; }
-
- [JsonPropertyName("address_state")] public string State { get; set; }
-
- [JsonPropertyName("address_street")] public string Street { get; set; }
-
- [JsonPropertyName("address_zip_code")] public string ZipCode { get; set; }
-
- [JsonPropertyName("email")] public string Email { get; set; }
-
- [JsonPropertyName("email_verified")] public bool EmailVerified { get; set; }
-
- [JsonPropertyName("phone_number")] public string PhoneNumber { get; set; }
-
- [JsonPropertyName("phone_number_verified")]
- public bool PhoneNumberVerified { get; set; }
-
- public static UserInfo Default { get; } = new();
-}
diff --git a/src/ClientApp/Platforms/Android/AndroidManifest.xml b/src/ClientApp/Platforms/Android/AndroidManifest.xml
deleted file mode 100644
index e2029c975..000000000
--- a/src/ClientApp/Platforms/Android/AndroidManifest.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ClientApp/Platforms/Android/MainActivity.cs b/src/ClientApp/Platforms/Android/MainActivity.cs
deleted file mode 100644
index 2f649ce3f..000000000
--- a/src/ClientApp/Platforms/Android/MainActivity.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using Android.App;
-using Android.Content.PM;
-
-namespace eShop.ClientApp;
-
-[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true,
- ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode |
- ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
-[IntentFilter(new[] {Platform.Intent.ActionAppAction},
- Categories = new[] {global::Android.Content.Intent.CategoryDefault})]
-public class MainActivity : MauiAppCompatActivity
-{
- protected override void OnResume()
- {
- base.OnResume();
-
- Platform.OnResume(this);
- }
-
- protected override void OnNewIntent(Android.Content.Intent intent)
- {
- base.OnNewIntent(intent);
-
- Platform.OnNewIntent(intent);
- }
-}
diff --git a/src/ClientApp/Platforms/Android/MainApplication.cs b/src/ClientApp/Platforms/Android/MainApplication.cs
deleted file mode 100644
index 30ea0cece..000000000
--- a/src/ClientApp/Platforms/Android/MainApplication.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using Android.App;
-using Android.Runtime;
-
-namespace eShop.ClientApp;
-
-[Application]
-public class MainApplication : MauiApplication
-{
- public MainApplication(IntPtr handle, JniHandleOwnership ownership)
- : base(handle, ownership)
- {
- }
-
- protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
-}
diff --git a/src/ClientApp/Platforms/Android/Resources/values/colors.xml b/src/ClientApp/Platforms/Android/Resources/values/colors.xml
deleted file mode 100644
index c04d7492a..000000000
--- a/src/ClientApp/Platforms/Android/Resources/values/colors.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- #512BD4
- #2B0B98
- #2B0B98
-
\ No newline at end of file
diff --git a/src/ClientApp/Platforms/Android/Resources/xml/network_security_config.xml b/src/ClientApp/Platforms/Android/Resources/xml/network_security_config.xml
deleted file mode 100644
index eb7159cfd..000000000
--- a/src/ClientApp/Platforms/Android/Resources/xml/network_security_config.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- 10.0.2.2
-
-
\ No newline at end of file
diff --git a/src/ClientApp/Platforms/Android/WebAuthenticationCallbackActivity.cs b/src/ClientApp/Platforms/Android/WebAuthenticationCallbackActivity.cs
deleted file mode 100644
index 61a7e4110..000000000
--- a/src/ClientApp/Platforms/Android/WebAuthenticationCallbackActivity.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using Android.App;
-using Android.Content.PM;
-
-namespace eShop.ClientApp;
-
-[Activity(NoHistory = true, LaunchMode = LaunchMode.SingleTop, Exported = true)]
-[IntentFilter(new[] { Android.Content.Intent.ActionView },
- Categories = new[] { Android.Content.Intent.CategoryDefault, Android.Content.Intent.CategoryBrowsable },
- DataScheme = "maui",
- DataHost = "authcallback")]
-public class WebAuthenticationCallbackActivity : Microsoft.Maui.Authentication.WebAuthenticatorCallbackActivity
-{
-
-}
diff --git a/src/ClientApp/Platforms/MacCatalyst/AppDelegate.cs b/src/ClientApp/Platforms/MacCatalyst/AppDelegate.cs
deleted file mode 100644
index 608817446..000000000
--- a/src/ClientApp/Platforms/MacCatalyst/AppDelegate.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using Foundation;
-
-namespace eShop.ClientApp;
-
-[Register("AppDelegate")]
-public class AppDelegate : MauiUIApplicationDelegate
-{
- protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
-}
diff --git a/src/ClientApp/Platforms/MacCatalyst/Entitlements.Debug.plist b/src/ClientApp/Platforms/MacCatalyst/Entitlements.Debug.plist
deleted file mode 100644
index 1659c8426..000000000
--- a/src/ClientApp/Platforms/MacCatalyst/Entitlements.Debug.plist
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
- com.apple.security.get-task-allow
-
-
-
-
diff --git a/src/ClientApp/Platforms/MacCatalyst/Entitlements.Release.plist b/src/ClientApp/Platforms/MacCatalyst/Entitlements.Release.plist
deleted file mode 100644
index 1db1d9371..000000000
--- a/src/ClientApp/Platforms/MacCatalyst/Entitlements.Release.plist
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
- com.apple.security.app-sandbox
-
- com.apple.security.network.client
-
-
-
-
diff --git a/src/ClientApp/Platforms/MacCatalyst/Info.plist b/src/ClientApp/Platforms/MacCatalyst/Info.plist
deleted file mode 100644
index efdc46559..000000000
--- a/src/ClientApp/Platforms/MacCatalyst/Info.plist
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
- UIDeviceFamily
-
- 1
- 2
-
- UIRequiredDeviceCapabilities
-
- arm64
-
- UISupportedInterfaceOrientations
-
- UIInterfaceOrientationPortrait
- UIInterfaceOrientationLandscapeLeft
- UIInterfaceOrientationLandscapeRight
-
- UISupportedInterfaceOrientations~ipad
-
- UIInterfaceOrientationPortrait
- UIInterfaceOrientationPortraitUpsideDown
- UIInterfaceOrientationLandscapeLeft
- UIInterfaceOrientationLandscapeRight
-
- NSAppTransportSecurity
-
- NSAllowsArbitraryLoads
-
-
- XSAppIconAssets
- Assets.xcassets/appicon.appiconset
- NSLocationWhenInUseUsageDescription
- Can we use your location when your app is being used?
-
-
diff --git a/src/ClientApp/Platforms/MacCatalyst/Program.cs b/src/ClientApp/Platforms/MacCatalyst/Program.cs
deleted file mode 100644
index 370463374..000000000
--- a/src/ClientApp/Platforms/MacCatalyst/Program.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using UIKit;
-
-namespace eShop.ClientApp;
-
-public class Program
-{
- // This is the main entry point of the application.
- static void Main(string[] args)
- {
- // if you want to use a different Application Delegate class from "AppDelegate"
- // you can specify it here.
- UIApplication.Main(args, null, typeof(AppDelegate));
- }
-}
diff --git a/src/ClientApp/Platforms/Windows/App.xaml b/src/ClientApp/Platforms/Windows/App.xaml
deleted file mode 100644
index 4abcebd26..000000000
--- a/src/ClientApp/Platforms/Windows/App.xaml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
diff --git a/src/ClientApp/Platforms/Windows/App.xaml.cs b/src/ClientApp/Platforms/Windows/App.xaml.cs
deleted file mode 100644
index d3bfbc8d8..000000000
--- a/src/ClientApp/Platforms/Windows/App.xaml.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-// To learn more about WinUI, the WinUI project structure,
-// and more about our project templates, see: http://aka.ms/winui-project-info.
-
-namespace eShop.ClientApp.WinUI;
-
-///
-/// Provides application-specific behavior to supplement the default Application class.
-///
-public partial class App : MauiWinUIApplication
-{
- ///
- /// Initializes the singleton application object. This is the first line of authored code
- /// executed, and as such is the logical equivalent of main() or WinMain().
- ///
- public App() => this.InitializeComponent();
-
- protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
-}
-
diff --git a/src/ClientApp/Platforms/Windows/Package.appxmanifest b/src/ClientApp/Platforms/Windows/Package.appxmanifest
deleted file mode 100644
index baa4f20f6..000000000
--- a/src/ClientApp/Platforms/Windows/Package.appxmanifest
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
- User Name
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/ClientApp/Platforms/Windows/app.manifest b/src/ClientApp/Platforms/Windows/app.manifest
deleted file mode 100644
index 6e8e58cbd..000000000
--- a/src/ClientApp/Platforms/Windows/app.manifest
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
- true/PM
- PerMonitorV2, PerMonitor
-
-
-
-
diff --git a/src/ClientApp/Platforms/iOS/AppDelegate.cs b/src/ClientApp/Platforms/iOS/AppDelegate.cs
deleted file mode 100644
index 608817446..000000000
--- a/src/ClientApp/Platforms/iOS/AppDelegate.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using Foundation;
-
-namespace eShop.ClientApp;
-
-[Register("AppDelegate")]
-public class AppDelegate : MauiUIApplicationDelegate
-{
- protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
-}
diff --git a/src/ClientApp/Platforms/iOS/Entitlements.plist b/src/ClientApp/Platforms/iOS/Entitlements.plist
deleted file mode 100644
index 9b48851d1..000000000
--- a/src/ClientApp/Platforms/iOS/Entitlements.plist
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
- keychain-access-groups
-
- $(AppIdentifierPrefix)com.companyname.eshop
-
-
-
diff --git a/src/ClientApp/Platforms/iOS/Info.plist b/src/ClientApp/Platforms/iOS/Info.plist
deleted file mode 100644
index 81f3c7747..000000000
--- a/src/ClientApp/Platforms/iOS/Info.plist
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
- LSRequiresIPhoneOS
-
- UIDeviceFamily
-
- 1
- 2
-
- UIRequiredDeviceCapabilities
-
- arm64
-
- UISupportedInterfaceOrientations
-
- UIInterfaceOrientationPortrait
- UIInterfaceOrientationLandscapeLeft
- UIInterfaceOrientationLandscapeRight
-
- UISupportedInterfaceOrientations~ipad
-
- UIInterfaceOrientationPortrait
- UIInterfaceOrientationPortraitUpsideDown
- UIInterfaceOrientationLandscapeLeft
- UIInterfaceOrientationLandscapeRight
-
- XSAppIconAssets
- Assets.xcassets/appicon.appiconset
- NSLocationWhenInUseUsageDescription
- Can we use your location when your app is being used?
- NSAppTransportSecurity
-
- NSAllowsLocalNetworking
-
-
-
-
\ No newline at end of file
diff --git a/src/ClientApp/Platforms/iOS/Program.cs b/src/ClientApp/Platforms/iOS/Program.cs
deleted file mode 100644
index 370463374..000000000
--- a/src/ClientApp/Platforms/iOS/Program.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using UIKit;
-
-namespace eShop.ClientApp;
-
-public class Program
-{
- // This is the main entry point of the application.
- static void Main(string[] args)
- {
- // if you want to use a different Application Delegate class from "AppDelegate"
- // you can specify it here.
- UIApplication.Main(args, null, typeof(AppDelegate));
- }
-}
diff --git a/src/ClientApp/Properties/launchSettings.json b/src/ClientApp/Properties/launchSettings.json
deleted file mode 100644
index edf8aadcc..000000000
--- a/src/ClientApp/Properties/launchSettings.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "profiles": {
- "Windows Machine": {
- "commandName": "MsixPackage",
- "nativeDebugging": false
- }
- }
-}
\ No newline at end of file
diff --git a/src/ClientApp/Resources/AppIcon/appicon.svg b/src/ClientApp/Resources/AppIcon/appicon.svg
deleted file mode 100644
index fee1791f3..000000000
--- a/src/ClientApp/Resources/AppIcon/appicon.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
\ No newline at end of file
diff --git a/src/ClientApp/Resources/AppIcon/appiconfg.svg b/src/ClientApp/Resources/AppIcon/appiconfg.svg
deleted file mode 100644
index a1b23236c..000000000
--- a/src/ClientApp/Resources/AppIcon/appiconfg.svg
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
diff --git a/src/ClientApp/Resources/Fonts/FontAwesomeRegular.otf b/src/ClientApp/Resources/Fonts/FontAwesomeRegular.otf
deleted file mode 100644
index bd594a982..000000000
Binary files a/src/ClientApp/Resources/Fonts/FontAwesomeRegular.otf and /dev/null differ
diff --git a/src/ClientApp/Resources/Fonts/FontAwesomeSolid.otf b/src/ClientApp/Resources/Fonts/FontAwesomeSolid.otf
deleted file mode 100644
index 8fb28d585..000000000
Binary files a/src/ClientApp/Resources/Fonts/FontAwesomeSolid.otf and /dev/null differ
diff --git a/src/ClientApp/Resources/Fonts/Montserrat-Bold.ttf b/src/ClientApp/Resources/Fonts/Montserrat-Bold.ttf
deleted file mode 100644
index ae33a4538..000000000
Binary files a/src/ClientApp/Resources/Fonts/Montserrat-Bold.ttf and /dev/null differ
diff --git a/src/ClientApp/Resources/Fonts/Montserrat-Regular.ttf b/src/ClientApp/Resources/Fonts/Montserrat-Regular.ttf
deleted file mode 100644
index 5b4b5afe6..000000000
Binary files a/src/ClientApp/Resources/Fonts/Montserrat-Regular.ttf and /dev/null differ
diff --git a/src/ClientApp/Resources/Images/arrow_left.svg b/src/ClientApp/Resources/Images/arrow_left.svg
deleted file mode 100644
index f445bb164..000000000
--- a/src/ClientApp/Resources/Images/arrow_left.svg
+++ /dev/null
@@ -1,7 +0,0 @@
-
diff --git a/src/ClientApp/Resources/Images/cart.svg b/src/ClientApp/Resources/Images/cart.svg
deleted file mode 100644
index 984cde08b..000000000
--- a/src/ClientApp/Resources/Images/cart.svg
+++ /dev/null
@@ -1,12 +0,0 @@
-
diff --git a/src/ClientApp/Resources/Images/close.svg b/src/ClientApp/Resources/Images/close.svg
deleted file mode 100644
index 6af9bc676..000000000
--- a/src/ClientApp/Resources/Images/close.svg
+++ /dev/null
@@ -1,8 +0,0 @@
-
diff --git a/src/ClientApp/Resources/Images/fake_product_01.png b/src/ClientApp/Resources/Images/fake_product_01.png
deleted file mode 100644
index 4cfaab90a..000000000
Binary files a/src/ClientApp/Resources/Images/fake_product_01.png and /dev/null differ
diff --git a/src/ClientApp/Resources/Images/fake_product_02.png b/src/ClientApp/Resources/Images/fake_product_02.png
deleted file mode 100644
index 30ce9f8dd..000000000
Binary files a/src/ClientApp/Resources/Images/fake_product_02.png and /dev/null differ
diff --git a/src/ClientApp/Resources/Images/fake_product_03.png b/src/ClientApp/Resources/Images/fake_product_03.png
deleted file mode 100644
index f37b87c3c..000000000
Binary files a/src/ClientApp/Resources/Images/fake_product_03.png and /dev/null differ
diff --git a/src/ClientApp/Resources/Images/fake_product_04.png b/src/ClientApp/Resources/Images/fake_product_04.png
deleted file mode 100644
index ef9bd44a7..000000000
Binary files a/src/ClientApp/Resources/Images/fake_product_04.png and /dev/null differ
diff --git a/src/ClientApp/Resources/Images/fake_product_05.png b/src/ClientApp/Resources/Images/fake_product_05.png
deleted file mode 100644
index 88f022edd..000000000
Binary files a/src/ClientApp/Resources/Images/fake_product_05.png and /dev/null differ
diff --git a/src/ClientApp/Resources/Images/fake_product_06.png b/src/ClientApp/Resources/Images/fake_product_06.png
deleted file mode 100644
index b16297dad..000000000
Binary files a/src/ClientApp/Resources/Images/fake_product_06.png and /dev/null differ
diff --git a/src/ClientApp/Resources/Images/filters.svg b/src/ClientApp/Resources/Images/filters.svg
deleted file mode 100644
index 3599bdaa8..000000000
--- a/src/ClientApp/Resources/Images/filters.svg
+++ /dev/null
@@ -1,7 +0,0 @@
-
diff --git a/src/ClientApp/Resources/Images/header.png b/src/ClientApp/Resources/Images/header.png
deleted file mode 100644
index 68c4fa65a..000000000
Binary files a/src/ClientApp/Resources/Images/header.png and /dev/null differ
diff --git a/src/ClientApp/Resources/Images/header_home.png b/src/ClientApp/Resources/Images/header_home.png
deleted file mode 100644
index f8d4a2c20..000000000
Binary files a/src/ClientApp/Resources/Images/header_home.png and /dev/null differ
diff --git a/src/ClientApp/Resources/Images/logo_footer.svg b/src/ClientApp/Resources/Images/logo_footer.svg
deleted file mode 100644
index a1b23236c..000000000
--- a/src/ClientApp/Resources/Images/logo_footer.svg
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
diff --git a/src/ClientApp/Resources/Images/logo_header.svg b/src/ClientApp/Resources/Images/logo_header.svg
deleted file mode 100644
index 2cd0931c2..000000000
--- a/src/ClientApp/Resources/Images/logo_header.svg
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
diff --git a/src/ClientApp/Resources/Images/noimage.png b/src/ClientApp/Resources/Images/noimage.png
deleted file mode 100644
index f27aa6e10..000000000
Binary files a/src/ClientApp/Resources/Images/noimage.png and /dev/null differ
diff --git a/src/ClientApp/Resources/Images/trash.svg b/src/ClientApp/Resources/Images/trash.svg
deleted file mode 100644
index d35700996..000000000
--- a/src/ClientApp/Resources/Images/trash.svg
+++ /dev/null
@@ -1,9 +0,0 @@
-
diff --git a/src/ClientApp/Resources/Images/user.svg b/src/ClientApp/Resources/Images/user.svg
deleted file mode 100644
index a733bc278..000000000
--- a/src/ClientApp/Resources/Images/user.svg
+++ /dev/null
@@ -1,6 +0,0 @@
-
diff --git a/src/ClientApp/Resources/Raw/AboutAssets.txt b/src/ClientApp/Resources/Raw/AboutAssets.txt
deleted file mode 100644
index 3f7a940be..000000000
--- a/src/ClientApp/Resources/Raw/AboutAssets.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-Any raw assets you want to be deployed with your application can be placed in
-this directory (and child directories) and given a Build Action of "MauiAsset":
-
-
-
-These files will be deployed with you package and will be accessible using Essentials:
-
- async Task LoadMauiAsset()
- {
- using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt");
- using var reader = new StreamReader(stream);
-
- var contents = reader.ReadToEnd();
- }
diff --git a/src/ClientApp/Resources/Splash/splash.svg b/src/ClientApp/Resources/Splash/splash.svg
deleted file mode 100644
index a1b23236c..000000000
--- a/src/ClientApp/Resources/Splash/splash.svg
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
diff --git a/src/ClientApp/Resources/Styles/Colors.xaml b/src/ClientApp/Resources/Styles/Colors.xaml
deleted file mode 100644
index ecc3bb044..000000000
--- a/src/ClientApp/Resources/Styles/Colors.xaml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
-
-
-
- #ffffff
- #000000
- #00857D
- #83D01B
- #00A69C
- #e2e2e2
- Gray
- #ff5252
- #000
- #444
- #FFFFFF
- #979797
- #007aff
- #CCCCCC
- #C9C9C9
- Transparent
- #FFFFFF
- Transparent
- #1FAECE
- Transparent
- Transparent
- #00857D
- #ed361a
- #2556cb
-
-
- #FFFFFF
- #222222
- #222222
- #FFFFFF
- #222222
- #E7E7E7
- #222222
- #E7E7E7
- #eeeeee
-
-
-
\ No newline at end of file
diff --git a/src/ClientApp/Resources/Styles/Styles.xaml b/src/ClientApp/Resources/Styles/Styles.xaml
deleted file mode 100644
index 9df4dcc76..000000000
--- a/src/ClientApp/Resources/Styles/Styles.xaml
+++ /dev/null
@@ -1,342 +0,0 @@
-
-
-
-
- 6
- 0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {0:MMMM dd yyyy}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ClientApp/Services/AppEnvironment/AppEnvironmentService.cs b/src/ClientApp/Services/AppEnvironment/AppEnvironmentService.cs
deleted file mode 100644
index c2a1db1b5..000000000
--- a/src/ClientApp/Services/AppEnvironment/AppEnvironmentService.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-using eShop.ClientApp.Services.Basket;
-using eShop.ClientApp.Services.Catalog;
-using eShop.ClientApp.Services.Identity;
-using eShop.ClientApp.Services.Order;
-
-namespace eShop.ClientApp.Services.AppEnvironment;
-
-public class AppEnvironmentService : IAppEnvironmentService
-{
- private readonly IBasketService _basketService;
- private readonly ICatalogService _catalogService;
- private readonly IIdentityService _identityService;
- private readonly IBasketService _mockBasketService;
-
- private readonly ICatalogService _mockCatalogService;
-
- private readonly IIdentityService _mockIdentityService;
-
- private readonly IOrderService _mockOrderService;
- private readonly IOrderService _orderService;
-
- public AppEnvironmentService(
- IBasketService mockBasketService, IBasketService basketService,
- ICatalogService mockCatalogService, ICatalogService catalogService,
- IOrderService mockOrderService, IOrderService orderService,
- IIdentityService mockIdentityService, IIdentityService identityService)
- {
- _mockBasketService = mockBasketService;
- _basketService = basketService;
-
- _mockCatalogService = mockCatalogService;
- _catalogService = catalogService;
-
- _mockOrderService = mockOrderService;
- _orderService = orderService;
-
- _mockIdentityService = mockIdentityService;
- _identityService = identityService;
- }
-
- public IBasketService BasketService { get; private set; }
-
- public ICatalogService CatalogService { get; private set; }
-
- public IOrderService OrderService { get; private set; }
-
- public IIdentityService IdentityService { get; private set; }
-
- public void UpdateDependencies(bool useMockServices)
- {
- if (useMockServices)
- {
- BasketService = _mockBasketService;
- CatalogService = _mockCatalogService;
- OrderService = _mockOrderService;
- IdentityService = _mockIdentityService;
- }
- else
- {
- BasketService = _basketService;
- CatalogService = _catalogService;
- OrderService = _orderService;
- IdentityService = _identityService;
- }
- }
-}
diff --git a/src/ClientApp/Services/AppEnvironment/IAppEnvironmentService.cs b/src/ClientApp/Services/AppEnvironment/IAppEnvironmentService.cs
deleted file mode 100644
index 909767c6b..000000000
--- a/src/ClientApp/Services/AppEnvironment/IAppEnvironmentService.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using eShop.ClientApp.Services.Basket;
-using eShop.ClientApp.Services.Catalog;
-using eShop.ClientApp.Services.Identity;
-using eShop.ClientApp.Services.Order;
-
-namespace eShop.ClientApp.Services.AppEnvironment;
-
-public interface IAppEnvironmentService
-{
- IBasketService BasketService { get; }
-
- ICatalogService CatalogService { get; }
-
- IOrderService OrderService { get; }
-
- IIdentityService IdentityService { get; }
-
- void UpdateDependencies(bool useMockServices);
-}
diff --git a/src/ClientApp/Services/Basket/BasketMockService.cs b/src/ClientApp/Services/Basket/BasketMockService.cs
deleted file mode 100644
index e954381db..000000000
--- a/src/ClientApp/Services/Basket/BasketMockService.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-using eShop.ClientApp.Models.Basket;
-
-namespace eShop.ClientApp.Services.Basket;
-
-public class BasketMockService : IBasketService
-{
- private CustomerBasket _mockCustomBasket;
-
- public BasketMockService()
- {
- _mockCustomBasket = new CustomerBasket {BuyerId = "9245fe4a-d402-451c-b9ed-9c1a04247482"};
- _mockCustomBasket.AddItemToBasket(new BasketItem
- {
- Id = "1",
- PictureUrl = "fake_product_01.png",
- ProductId = Common.Common.MockCatalogItemId01,
- ProductName = ".NET Bot Blue Sweatshirt (M)",
- Quantity = 1,
- UnitPrice = 19.50M
- });
-
- _mockCustomBasket.AddItemToBasket(new BasketItem
- {
- Id = "2",
- PictureUrl = "fake_product_04.png",
- ProductId = Common.Common.MockCatalogItemId04,
- ProductName = ".NET Black Cup",
- Quantity = 1,
- UnitPrice = 17.00M
- });
- }
-
- public IEnumerable LocalBasketItems { get; set; }
-
- public async Task GetBasketAsync()
- {
- await Task.Delay(10);
-
- return _mockCustomBasket;
- }
-
- public async Task UpdateBasketAsync(CustomerBasket customerBasket)
- {
- await Task.Delay(10);
-
- _mockCustomBasket = customerBasket;
-
- return _mockCustomBasket;
- }
-
- public async Task ClearBasketAsync()
- {
- await Task.Delay(10);
-
- _mockCustomBasket.ClearBasket();
-
- LocalBasketItems = null;
- }
-}
diff --git a/src/ClientApp/Services/Basket/BasketService.cs b/src/ClientApp/Services/Basket/BasketService.cs
deleted file mode 100644
index 6772b649a..000000000
--- a/src/ClientApp/Services/Basket/BasketService.cs
+++ /dev/null
@@ -1,151 +0,0 @@
-using eShop.ClientApp.BasketGrpcClient;
-using eShop.ClientApp.Models.Basket;
-using eShop.ClientApp.Services.FixUri;
-using eShop.ClientApp.Services.Identity;
-using eShop.ClientApp.Services.Settings;
-using Google.Protobuf;
-using Grpc.Core;
-using Grpc.Net.Client;
-using BasketItem = eShop.ClientApp.Models.Basket.BasketItem;
-
-namespace eShop.ClientApp.Services.Basket;
-
-public class BasketService : IBasketService, IDisposable
-{
- private readonly IFixUriService _fixUriService;
- private readonly IIdentityService _identityService;
- private readonly ISettingsService _settingsService;
- private BasketGrpcClient.Basket.BasketClient _basketClient;
-
- private GrpcChannel _channel;
-
- public BasketService(IIdentityService identityService, ISettingsService settingsService,
- IFixUriService fixUriService)
- {
- _identityService = identityService;
- _settingsService = settingsService;
- _fixUriService = fixUriService;
- }
-
- public IEnumerable LocalBasketItems { get; set; }
-
- public async Task GetBasketAsync()
- {
- CustomerBasket basket = new();
-
- var authToken = await _identityService.GetAuthTokenAsync().ConfigureAwait(false);
-
- if (string.IsNullOrEmpty(authToken))
- {
- return basket;
- }
-
- try
- {
- var basketResponse = await GetBasketClient()
- .GetBasketAsync(new GetBasketRequest(), CreateAuthenticationHeaders(authToken));
-
- if (basketResponse.IsInitialized() && basketResponse.Items.Any())
- {
- foreach (var item in basketResponse.Items)
- {
- basket.AddItemToBasket(new BasketItem {ProductId = item.ProductId, Quantity = item.Quantity});
- }
- }
- }
- catch (Exception exception)
- {
- Console.WriteLine(exception);
- basket = null;
- }
-
- _fixUriService.FixBasketItemPictureUri(basket?.Items);
- return basket;
- }
-
- public async Task UpdateBasketAsync(CustomerBasket customerBasket)
- {
- var authToken = await _identityService.GetAuthTokenAsync().ConfigureAwait(false);
-
- if (string.IsNullOrEmpty(authToken))
- {
- return customerBasket;
- }
-
- var updateBasketRequest = new UpdateBasketRequest();
-
- updateBasketRequest.Items.Add(
- customerBasket.Items
- .Select(
- x =>
- new BasketGrpcClient.BasketItem {ProductId = x.ProductId, Quantity = x.Quantity}));
-
- var result = await GetBasketClient()
- .UpdateBasketAsync(updateBasketRequest, CreateAuthenticationHeaders(authToken)).ConfigureAwait(false);
-
- if (result.Items.Count > 0)
- {
- customerBasket.ClearBasket();
- }
-
- foreach (var item in result.Items)
- {
- customerBasket.AddItemToBasket(new BasketItem {ProductId = item.ProductId, Quantity = item.Quantity});
- }
-
- return customerBasket;
- }
-
- public async Task ClearBasketAsync()
- {
- var authToken = await _identityService.GetAuthTokenAsync().ConfigureAwait(false);
-
- if (string.IsNullOrEmpty(authToken))
- {
- return;
- }
-
- await GetBasketClient().DeleteBasketAsync(new DeleteBasketRequest(), CreateAuthenticationHeaders(authToken))
- .ConfigureAwait(false);
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- private BasketGrpcClient.Basket.BasketClient GetBasketClient()
- {
- if (_basketClient is not null)
- {
- return _basketClient;
- }
-
- _channel = GrpcChannel.ForAddress(_settingsService.GatewayBasketEndpointBase);
-
- _basketClient = new BasketGrpcClient.Basket.BasketClient(_channel);
-
- return _basketClient;
- }
-
- private Metadata CreateAuthenticationHeaders(string token)
- {
- var headers = new Metadata();
- headers.Add("authorization", $"Bearer {token}");
- return headers;
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- _channel?.Dispose();
- }
- }
-
- ~BasketService()
- {
- Dispose(false);
- }
-}
diff --git a/src/ClientApp/Services/Basket/IBasketService.cs b/src/ClientApp/Services/Basket/IBasketService.cs
deleted file mode 100644
index 615ea8aed..000000000
--- a/src/ClientApp/Services/Basket/IBasketService.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using eShop.ClientApp.Models.Basket;
-
-namespace eShop.ClientApp.Services.Basket;
-
-public interface IBasketService
-{
- IEnumerable LocalBasketItems { get; set; }
- Task GetBasketAsync();
- Task UpdateBasketAsync(CustomerBasket customerBasket);
- Task ClearBasketAsync();
-}
diff --git a/src/ClientApp/Services/Basket/Protos/Basket.cs b/src/ClientApp/Services/Basket/Protos/Basket.cs
deleted file mode 100644
index d725f4527..000000000
--- a/src/ClientApp/Services/Basket/Protos/Basket.cs
+++ /dev/null
@@ -1,1152 +0,0 @@
-//
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: Services/Basket/Protos/basket.proto
-//
-#pragma warning disable 1591, 0612, 3021, 8981
-#region Designer generated code
-
-using pb = global::Google.Protobuf;
-using pbc = global::Google.Protobuf.Collections;
-using pbr = global::Google.Protobuf.Reflection;
-using scg = global::System.Collections.Generic;
-namespace eShop.ClientApp.BasketGrpcClient {
-
- /// Holder for reflection information generated from Services/Basket/Protos/basket.proto
- public static partial class BasketReflection {
-
- #region Descriptor
- /// File descriptor for Services/Basket/Protos/basket.proto
- public static pbr::FileDescriptor Descriptor {
- get { return descriptor; }
- }
- private static pbr::FileDescriptor descriptor;
-
- static BasketReflection() {
- byte[] descriptorData = global::System.Convert.FromBase64String(
- string.Concat(
- "CiNTZXJ2aWNlcy9CYXNrZXQvUHJvdG9zL2Jhc2tldC5wcm90bxIJQmFza2V0",
- "QXBpIhIKEEdldEJhc2tldFJlcXVlc3QiPgoWQ3VzdG9tZXJCYXNrZXRSZXNw",
- "b25zZRIkCgVpdGVtcxgBIAMoCzIVLkJhc2tldEFwaS5CYXNrZXRJdGVtIjIK",
- "CkJhc2tldEl0ZW0SEgoKcHJvZHVjdF9pZBgCIAEoBRIQCghxdWFudGl0eRgG",
- "IAEoBSI7ChNVcGRhdGVCYXNrZXRSZXF1ZXN0EiQKBWl0ZW1zGAIgAygLMhUu",
- "QmFza2V0QXBpLkJhc2tldEl0ZW0iFQoTRGVsZXRlQmFza2V0UmVxdWVzdCIW",
- "ChREZWxldGVCYXNrZXRSZXNwb25zZTL/AQoGQmFza2V0Ek0KCUdldEJhc2tl",
- "dBIbLkJhc2tldEFwaS5HZXRCYXNrZXRSZXF1ZXN0GiEuQmFza2V0QXBpLkN1",
- "c3RvbWVyQmFza2V0UmVzcG9uc2UiABJTCgxVcGRhdGVCYXNrZXQSHi5CYXNr",
- "ZXRBcGkuVXBkYXRlQmFza2V0UmVxdWVzdBohLkJhc2tldEFwaS5DdXN0b21l",
- "ckJhc2tldFJlc3BvbnNlIgASUQoMRGVsZXRlQmFza2V0Eh4uQmFza2V0QXBp",
- "LkRlbGV0ZUJhc2tldFJlcXVlc3QaHy5CYXNrZXRBcGkuRGVsZXRlQmFza2V0",
- "UmVzcG9uc2UiAEIjqgIgZVNob3AuQ2xpZW50QXBwLkJhc2tldEdycGNDbGll",
- "bnRiBnByb3RvMw=="));
- descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
- new pbr::FileDescriptor[] { },
- new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
- new pbr::GeneratedClrTypeInfo(typeof(global::eShop.ClientApp.BasketGrpcClient.GetBasketRequest), global::eShop.ClientApp.BasketGrpcClient.GetBasketRequest.Parser, null, null, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::eShop.ClientApp.BasketGrpcClient.CustomerBasketResponse), global::eShop.ClientApp.BasketGrpcClient.CustomerBasketResponse.Parser, new[]{ "Items" }, null, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::eShop.ClientApp.BasketGrpcClient.BasketItem), global::eShop.ClientApp.BasketGrpcClient.BasketItem.Parser, new[]{ "ProductId", "Quantity" }, null, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::eShop.ClientApp.BasketGrpcClient.UpdateBasketRequest), global::eShop.ClientApp.BasketGrpcClient.UpdateBasketRequest.Parser, new[]{ "Items" }, null, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::eShop.ClientApp.BasketGrpcClient.DeleteBasketRequest), global::eShop.ClientApp.BasketGrpcClient.DeleteBasketRequest.Parser, null, null, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::eShop.ClientApp.BasketGrpcClient.DeleteBasketResponse), global::eShop.ClientApp.BasketGrpcClient.DeleteBasketResponse.Parser, null, null, null, null, null)
- }));
- }
- #endregion
-
- }
- #region Messages
- [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
- public sealed partial class GetBasketRequest : pb::IMessage
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- , pb::IBufferMessage
- #endif
- {
- private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetBasketRequest());
- private pb::UnknownFieldSet _unknownFields;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public static pb::MessageParser Parser { get { return _parser; } }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public static pbr::MessageDescriptor Descriptor {
- get { return global::eShop.ClientApp.BasketGrpcClient.BasketReflection.Descriptor.MessageTypes[0]; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- pbr::MessageDescriptor pb::IMessage.Descriptor {
- get { return Descriptor; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public GetBasketRequest() {
- OnConstruction();
- }
-
- partial void OnConstruction();
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public GetBasketRequest(GetBasketRequest other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public GetBasketRequest Clone() {
- return new GetBasketRequest(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override bool Equals(object other) {
- return Equals(other as GetBasketRequest);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public bool Equals(GetBasketRequest other) {
- if (ReferenceEquals(other, null)) {
- return false;
- }
- if (ReferenceEquals(other, this)) {
- return true;
- }
- return Equals(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override int GetHashCode() {
- int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
- return hash;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override string ToString() {
- return pb::JsonFormatter.ToDiagnosticString(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void WriteTo(pb::CodedOutputStream output) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- output.WriteRawMessage(this);
- #else
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(ref output);
- }
- }
- #endif
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public int CalculateSize() {
- int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
- return size;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void MergeFrom(GetBasketRequest other) {
- if (other == null) {
- return;
- }
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void MergeFrom(pb::CodedInputStream input) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- input.ReadRawMessage(this);
- #else
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- if ((tag & 7) == 4) {
- // Abort on any end group tag.
- return;
- }
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
- break;
- }
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- if ((tag & 7) == 4) {
- // Abort on any end group tag.
- return;
- }
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
- break;
- }
- }
- }
- #endif
-
- }
-
- [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
- public sealed partial class CustomerBasketResponse : pb::IMessage
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- , pb::IBufferMessage
- #endif
- {
- private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomerBasketResponse());
- private pb::UnknownFieldSet _unknownFields;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public static pb::MessageParser Parser { get { return _parser; } }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public static pbr::MessageDescriptor Descriptor {
- get { return global::eShop.ClientApp.BasketGrpcClient.BasketReflection.Descriptor.MessageTypes[1]; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- pbr::MessageDescriptor pb::IMessage.Descriptor {
- get { return Descriptor; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public CustomerBasketResponse() {
- OnConstruction();
- }
-
- partial void OnConstruction();
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public CustomerBasketResponse(CustomerBasketResponse other) : this() {
- items_ = other.items_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public CustomerBasketResponse Clone() {
- return new CustomerBasketResponse(this);
- }
-
- /// Field number for the "items" field.
- public const int ItemsFieldNumber = 1;
- private static readonly pb::FieldCodec _repeated_items_codec
- = pb::FieldCodec.ForMessage(10, global::eShop.ClientApp.BasketGrpcClient.BasketItem.Parser);
- private readonly pbc::RepeatedField items_ = new pbc::RepeatedField();
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public pbc::RepeatedField Items {
- get { return items_; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override bool Equals(object other) {
- return Equals(other as CustomerBasketResponse);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public bool Equals(CustomerBasketResponse other) {
- if (ReferenceEquals(other, null)) {
- return false;
- }
- if (ReferenceEquals(other, this)) {
- return true;
- }
- if(!items_.Equals(other.items_)) return false;
- return Equals(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override int GetHashCode() {
- int hash = 1;
- hash ^= items_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
- return hash;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override string ToString() {
- return pb::JsonFormatter.ToDiagnosticString(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void WriteTo(pb::CodedOutputStream output) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- output.WriteRawMessage(this);
- #else
- items_.WriteTo(output, _repeated_items_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
- items_.WriteTo(ref output, _repeated_items_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(ref output);
- }
- }
- #endif
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public int CalculateSize() {
- int size = 0;
- size += items_.CalculateSize(_repeated_items_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
- return size;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void MergeFrom(CustomerBasketResponse other) {
- if (other == null) {
- return;
- }
- items_.Add(other.items_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void MergeFrom(pb::CodedInputStream input) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- input.ReadRawMessage(this);
- #else
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- if ((tag & 7) == 4) {
- // Abort on any end group tag.
- return;
- }
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
- break;
- case 10: {
- items_.AddEntriesFrom(input, _repeated_items_codec);
- break;
- }
- }
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- if ((tag & 7) == 4) {
- // Abort on any end group tag.
- return;
- }
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
- break;
- case 10: {
- items_.AddEntriesFrom(ref input, _repeated_items_codec);
- break;
- }
- }
- }
- }
- #endif
-
- }
-
- [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
- public sealed partial class BasketItem : pb::IMessage
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- , pb::IBufferMessage
- #endif
- {
- private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BasketItem());
- private pb::UnknownFieldSet _unknownFields;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public static pb::MessageParser Parser { get { return _parser; } }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public static pbr::MessageDescriptor Descriptor {
- get { return global::eShop.ClientApp.BasketGrpcClient.BasketReflection.Descriptor.MessageTypes[2]; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- pbr::MessageDescriptor pb::IMessage.Descriptor {
- get { return Descriptor; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public BasketItem() {
- OnConstruction();
- }
-
- partial void OnConstruction();
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public BasketItem(BasketItem other) : this() {
- productId_ = other.productId_;
- quantity_ = other.quantity_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public BasketItem Clone() {
- return new BasketItem(this);
- }
-
- /// Field number for the "product_id" field.
- public const int ProductIdFieldNumber = 2;
- private int productId_;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public int ProductId {
- get { return productId_; }
- set {
- productId_ = value;
- }
- }
-
- /// Field number for the "quantity" field.
- public const int QuantityFieldNumber = 6;
- private int quantity_;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public int Quantity {
- get { return quantity_; }
- set {
- quantity_ = value;
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override bool Equals(object other) {
- return Equals(other as BasketItem);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public bool Equals(BasketItem other) {
- if (ReferenceEquals(other, null)) {
- return false;
- }
- if (ReferenceEquals(other, this)) {
- return true;
- }
- if (ProductId != other.ProductId) return false;
- if (Quantity != other.Quantity) return false;
- return Equals(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override int GetHashCode() {
- int hash = 1;
- if (ProductId != 0) hash ^= ProductId.GetHashCode();
- if (Quantity != 0) hash ^= Quantity.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
- return hash;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override string ToString() {
- return pb::JsonFormatter.ToDiagnosticString(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void WriteTo(pb::CodedOutputStream output) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- output.WriteRawMessage(this);
- #else
- if (ProductId != 0) {
- output.WriteRawTag(16);
- output.WriteInt32(ProductId);
- }
- if (Quantity != 0) {
- output.WriteRawTag(48);
- output.WriteInt32(Quantity);
- }
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
- if (ProductId != 0) {
- output.WriteRawTag(16);
- output.WriteInt32(ProductId);
- }
- if (Quantity != 0) {
- output.WriteRawTag(48);
- output.WriteInt32(Quantity);
- }
- if (_unknownFields != null) {
- _unknownFields.WriteTo(ref output);
- }
- }
- #endif
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public int CalculateSize() {
- int size = 0;
- if (ProductId != 0) {
- size += 1 + pb::CodedOutputStream.ComputeInt32Size(ProductId);
- }
- if (Quantity != 0) {
- size += 1 + pb::CodedOutputStream.ComputeInt32Size(Quantity);
- }
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
- return size;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void MergeFrom(BasketItem other) {
- if (other == null) {
- return;
- }
- if (other.ProductId != 0) {
- ProductId = other.ProductId;
- }
- if (other.Quantity != 0) {
- Quantity = other.Quantity;
- }
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void MergeFrom(pb::CodedInputStream input) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- input.ReadRawMessage(this);
- #else
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- if ((tag & 7) == 4) {
- // Abort on any end group tag.
- return;
- }
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
- break;
- case 16: {
- ProductId = input.ReadInt32();
- break;
- }
- case 48: {
- Quantity = input.ReadInt32();
- break;
- }
- }
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- if ((tag & 7) == 4) {
- // Abort on any end group tag.
- return;
- }
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
- break;
- case 16: {
- ProductId = input.ReadInt32();
- break;
- }
- case 48: {
- Quantity = input.ReadInt32();
- break;
- }
- }
- }
- }
- #endif
-
- }
-
- [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
- public sealed partial class UpdateBasketRequest : pb::IMessage
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- , pb::IBufferMessage
- #endif
- {
- private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UpdateBasketRequest());
- private pb::UnknownFieldSet _unknownFields;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public static pb::MessageParser Parser { get { return _parser; } }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public static pbr::MessageDescriptor Descriptor {
- get { return global::eShop.ClientApp.BasketGrpcClient.BasketReflection.Descriptor.MessageTypes[3]; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- pbr::MessageDescriptor pb::IMessage.Descriptor {
- get { return Descriptor; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public UpdateBasketRequest() {
- OnConstruction();
- }
-
- partial void OnConstruction();
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public UpdateBasketRequest(UpdateBasketRequest other) : this() {
- items_ = other.items_.Clone();
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public UpdateBasketRequest Clone() {
- return new UpdateBasketRequest(this);
- }
-
- /// Field number for the "items" field.
- public const int ItemsFieldNumber = 2;
- private static readonly pb::FieldCodec _repeated_items_codec
- = pb::FieldCodec.ForMessage(18, global::eShop.ClientApp.BasketGrpcClient.BasketItem.Parser);
- private readonly pbc::RepeatedField items_ = new pbc::RepeatedField();
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public pbc::RepeatedField Items {
- get { return items_; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override bool Equals(object other) {
- return Equals(other as UpdateBasketRequest);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public bool Equals(UpdateBasketRequest other) {
- if (ReferenceEquals(other, null)) {
- return false;
- }
- if (ReferenceEquals(other, this)) {
- return true;
- }
- if(!items_.Equals(other.items_)) return false;
- return Equals(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override int GetHashCode() {
- int hash = 1;
- hash ^= items_.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
- return hash;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override string ToString() {
- return pb::JsonFormatter.ToDiagnosticString(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void WriteTo(pb::CodedOutputStream output) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- output.WriteRawMessage(this);
- #else
- items_.WriteTo(output, _repeated_items_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
- items_.WriteTo(ref output, _repeated_items_codec);
- if (_unknownFields != null) {
- _unknownFields.WriteTo(ref output);
- }
- }
- #endif
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public int CalculateSize() {
- int size = 0;
- size += items_.CalculateSize(_repeated_items_codec);
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
- return size;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void MergeFrom(UpdateBasketRequest other) {
- if (other == null) {
- return;
- }
- items_.Add(other.items_);
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void MergeFrom(pb::CodedInputStream input) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- input.ReadRawMessage(this);
- #else
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- if ((tag & 7) == 4) {
- // Abort on any end group tag.
- return;
- }
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
- break;
- case 18: {
- items_.AddEntriesFrom(input, _repeated_items_codec);
- break;
- }
- }
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- if ((tag & 7) == 4) {
- // Abort on any end group tag.
- return;
- }
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
- break;
- case 18: {
- items_.AddEntriesFrom(ref input, _repeated_items_codec);
- break;
- }
- }
- }
- }
- #endif
-
- }
-
- [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
- public sealed partial class DeleteBasketRequest : pb::IMessage
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- , pb::IBufferMessage
- #endif
- {
- private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeleteBasketRequest());
- private pb::UnknownFieldSet _unknownFields;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public static pb::MessageParser Parser { get { return _parser; } }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public static pbr::MessageDescriptor Descriptor {
- get { return global::eShop.ClientApp.BasketGrpcClient.BasketReflection.Descriptor.MessageTypes[4]; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- pbr::MessageDescriptor pb::IMessage.Descriptor {
- get { return Descriptor; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public DeleteBasketRequest() {
- OnConstruction();
- }
-
- partial void OnConstruction();
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public DeleteBasketRequest(DeleteBasketRequest other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public DeleteBasketRequest Clone() {
- return new DeleteBasketRequest(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override bool Equals(object other) {
- return Equals(other as DeleteBasketRequest);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public bool Equals(DeleteBasketRequest other) {
- if (ReferenceEquals(other, null)) {
- return false;
- }
- if (ReferenceEquals(other, this)) {
- return true;
- }
- return Equals(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override int GetHashCode() {
- int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
- return hash;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override string ToString() {
- return pb::JsonFormatter.ToDiagnosticString(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void WriteTo(pb::CodedOutputStream output) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- output.WriteRawMessage(this);
- #else
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(ref output);
- }
- }
- #endif
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public int CalculateSize() {
- int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
- return size;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void MergeFrom(DeleteBasketRequest other) {
- if (other == null) {
- return;
- }
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void MergeFrom(pb::CodedInputStream input) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- input.ReadRawMessage(this);
- #else
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- if ((tag & 7) == 4) {
- // Abort on any end group tag.
- return;
- }
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
- break;
- }
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- if ((tag & 7) == 4) {
- // Abort on any end group tag.
- return;
- }
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
- break;
- }
- }
- }
- #endif
-
- }
-
- [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
- public sealed partial class DeleteBasketResponse : pb::IMessage
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- , pb::IBufferMessage
- #endif
- {
- private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeleteBasketResponse());
- private pb::UnknownFieldSet _unknownFields;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public static pb::MessageParser Parser { get { return _parser; } }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public static pbr::MessageDescriptor Descriptor {
- get { return global::eShop.ClientApp.BasketGrpcClient.BasketReflection.Descriptor.MessageTypes[5]; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- pbr::MessageDescriptor pb::IMessage.Descriptor {
- get { return Descriptor; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public DeleteBasketResponse() {
- OnConstruction();
- }
-
- partial void OnConstruction();
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public DeleteBasketResponse(DeleteBasketResponse other) : this() {
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public DeleteBasketResponse Clone() {
- return new DeleteBasketResponse(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override bool Equals(object other) {
- return Equals(other as DeleteBasketResponse);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public bool Equals(DeleteBasketResponse other) {
- if (ReferenceEquals(other, null)) {
- return false;
- }
- if (ReferenceEquals(other, this)) {
- return true;
- }
- return Equals(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override int GetHashCode() {
- int hash = 1;
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
- return hash;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override string ToString() {
- return pb::JsonFormatter.ToDiagnosticString(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void WriteTo(pb::CodedOutputStream output) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- output.WriteRawMessage(this);
- #else
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
- if (_unknownFields != null) {
- _unknownFields.WriteTo(ref output);
- }
- }
- #endif
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public int CalculateSize() {
- int size = 0;
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
- return size;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void MergeFrom(DeleteBasketResponse other) {
- if (other == null) {
- return;
- }
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void MergeFrom(pb::CodedInputStream input) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- input.ReadRawMessage(this);
- #else
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- if ((tag & 7) == 4) {
- // Abort on any end group tag.
- return;
- }
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
- break;
- }
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- if ((tag & 7) == 4) {
- // Abort on any end group tag.
- return;
- }
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
- break;
- }
- }
- }
- #endif
-
- }
-
- #endregion
-
-}
-
-#endregion Designer generated code
diff --git a/src/ClientApp/Services/Basket/Protos/BasketGrpc.cs b/src/ClientApp/Services/Basket/Protos/BasketGrpc.cs
deleted file mode 100644
index 2d3bbf456..000000000
--- a/src/ClientApp/Services/Basket/Protos/BasketGrpc.cs
+++ /dev/null
@@ -1,186 +0,0 @@
-//
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: Services/Basket/Protos/basket.proto
-//
-#pragma warning disable 0414, 1591, 8981, 0612
-#region Designer generated code
-
-using grpc = global::Grpc.Core;
-
-namespace eShop.ClientApp.BasketGrpcClient {
- public static partial class Basket
- {
- static readonly string __ServiceName = "BasketApi.Basket";
-
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
- {
- #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
- if (message is global::Google.Protobuf.IBufferMessage)
- {
- context.SetPayloadLength(message.CalculateSize());
- global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
- context.Complete();
- return;
- }
- #endif
- context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
- }
-
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- static class __Helper_MessageCache
- {
- public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
- }
-
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage
- {
- #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
- if (__Helper_MessageCache.IsBufferMessage)
- {
- return parser.ParseFrom(context.PayloadAsReadOnlySequence());
- }
- #endif
- return parser.ParseFrom(context.PayloadAsNewBuffer());
- }
-
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- static readonly grpc::Marshaller __Marshaller_BasketApi_GetBasketRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::eShop.ClientApp.BasketGrpcClient.GetBasketRequest.Parser));
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- static readonly grpc::Marshaller __Marshaller_BasketApi_CustomerBasketResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::eShop.ClientApp.BasketGrpcClient.CustomerBasketResponse.Parser));
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- static readonly grpc::Marshaller __Marshaller_BasketApi_UpdateBasketRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::eShop.ClientApp.BasketGrpcClient.UpdateBasketRequest.Parser));
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- static readonly grpc::Marshaller __Marshaller_BasketApi_DeleteBasketRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::eShop.ClientApp.BasketGrpcClient.DeleteBasketRequest.Parser));
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- static readonly grpc::Marshaller __Marshaller_BasketApi_DeleteBasketResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::eShop.ClientApp.BasketGrpcClient.DeleteBasketResponse.Parser));
-
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- static readonly grpc::Method __Method_GetBasket = new grpc::Method(
- grpc::MethodType.Unary,
- __ServiceName,
- "GetBasket",
- __Marshaller_BasketApi_GetBasketRequest,
- __Marshaller_BasketApi_CustomerBasketResponse);
-
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- static readonly grpc::Method __Method_UpdateBasket = new grpc::Method(
- grpc::MethodType.Unary,
- __ServiceName,
- "UpdateBasket",
- __Marshaller_BasketApi_UpdateBasketRequest,
- __Marshaller_BasketApi_CustomerBasketResponse);
-
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- static readonly grpc::Method __Method_DeleteBasket = new grpc::Method(
- grpc::MethodType.Unary,
- __ServiceName,
- "DeleteBasket",
- __Marshaller_BasketApi_DeleteBasketRequest,
- __Marshaller_BasketApi_DeleteBasketResponse);
-
- /// Service descriptor
- public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
- {
- get { return global::eShop.ClientApp.BasketGrpcClient.BasketReflection.Descriptor.Services[0]; }
- }
-
- /// Client for Basket
- public partial class BasketClient : grpc::ClientBase
- {
- /// Creates a new client for Basket
- /// The channel to use to make remote calls.
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public BasketClient(grpc::ChannelBase channel) : base(channel)
- {
- }
- /// Creates a new client for Basket that uses a custom CallInvoker.
- /// The callInvoker to use to make remote calls.
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public BasketClient(grpc::CallInvoker callInvoker) : base(callInvoker)
- {
- }
- /// Protected parameterless constructor to allow creation of test doubles.
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- protected BasketClient() : base()
- {
- }
- /// Protected constructor to allow creation of configured clients.
- /// The client configuration.
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- protected BasketClient(ClientBaseConfiguration configuration) : base(configuration)
- {
- }
-
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public virtual global::eShop.ClientApp.BasketGrpcClient.CustomerBasketResponse GetBasket(global::eShop.ClientApp.BasketGrpcClient.GetBasketRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
- {
- return GetBasket(request, new grpc::CallOptions(headers, deadline, cancellationToken));
- }
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public virtual global::eShop.ClientApp.BasketGrpcClient.CustomerBasketResponse GetBasket(global::eShop.ClientApp.BasketGrpcClient.GetBasketRequest request, grpc::CallOptions options)
- {
- return CallInvoker.BlockingUnaryCall(__Method_GetBasket, null, options, request);
- }
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public virtual grpc::AsyncUnaryCall GetBasketAsync(global::eShop.ClientApp.BasketGrpcClient.GetBasketRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
- {
- return GetBasketAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
- }
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public virtual grpc::AsyncUnaryCall GetBasketAsync(global::eShop.ClientApp.BasketGrpcClient.GetBasketRequest request, grpc::CallOptions options)
- {
- return CallInvoker.AsyncUnaryCall(__Method_GetBasket, null, options, request);
- }
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public virtual global::eShop.ClientApp.BasketGrpcClient.CustomerBasketResponse UpdateBasket(global::eShop.ClientApp.BasketGrpcClient.UpdateBasketRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
- {
- return UpdateBasket(request, new grpc::CallOptions(headers, deadline, cancellationToken));
- }
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public virtual global::eShop.ClientApp.BasketGrpcClient.CustomerBasketResponse UpdateBasket(global::eShop.ClientApp.BasketGrpcClient.UpdateBasketRequest request, grpc::CallOptions options)
- {
- return CallInvoker.BlockingUnaryCall(__Method_UpdateBasket, null, options, request);
- }
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public virtual grpc::AsyncUnaryCall UpdateBasketAsync(global::eShop.ClientApp.BasketGrpcClient.UpdateBasketRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
- {
- return UpdateBasketAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
- }
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public virtual grpc::AsyncUnaryCall UpdateBasketAsync(global::eShop.ClientApp.BasketGrpcClient.UpdateBasketRequest request, grpc::CallOptions options)
- {
- return CallInvoker.AsyncUnaryCall(__Method_UpdateBasket, null, options, request);
- }
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public virtual global::eShop.ClientApp.BasketGrpcClient.DeleteBasketResponse DeleteBasket(global::eShop.ClientApp.BasketGrpcClient.DeleteBasketRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
- {
- return DeleteBasket(request, new grpc::CallOptions(headers, deadline, cancellationToken));
- }
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public virtual global::eShop.ClientApp.BasketGrpcClient.DeleteBasketResponse DeleteBasket(global::eShop.ClientApp.BasketGrpcClient.DeleteBasketRequest request, grpc::CallOptions options)
- {
- return CallInvoker.BlockingUnaryCall(__Method_DeleteBasket, null, options, request);
- }
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public virtual grpc::AsyncUnaryCall DeleteBasketAsync(global::eShop.ClientApp.BasketGrpcClient.DeleteBasketRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
- {
- return DeleteBasketAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
- }
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public virtual grpc::AsyncUnaryCall DeleteBasketAsync(global::eShop.ClientApp.BasketGrpcClient.DeleteBasketRequest request, grpc::CallOptions options)
- {
- return CallInvoker.AsyncUnaryCall(__Method_DeleteBasket, null, options, request);
- }
- /// Creates a new instance of client from given ClientBaseConfiguration.
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- protected override BasketClient NewInstance(ClientBaseConfiguration configuration)
- {
- return new BasketClient(configuration);
- }
- }
-
- }
-}
-#endregion
diff --git a/src/ClientApp/Services/Basket/Protos/basket.proto b/src/ClientApp/Services/Basket/Protos/basket.proto
deleted file mode 100644
index 962c56ff1..000000000
--- a/src/ClientApp/Services/Basket/Protos/basket.proto
+++ /dev/null
@@ -1,33 +0,0 @@
-syntax = "proto3";
-
-option csharp_namespace = "eShop.ClientApp.BasketGrpcClient";
-
-package BasketApi;
-
-service Basket {
- rpc GetBasket(GetBasketRequest) returns (CustomerBasketResponse) {}
- rpc UpdateBasket(UpdateBasketRequest) returns (CustomerBasketResponse) {}
- rpc DeleteBasket(DeleteBasketRequest) returns (DeleteBasketResponse) {}
-}
-
-message GetBasketRequest {
-}
-
-message CustomerBasketResponse {
- repeated BasketItem items = 1;
-}
-
-message BasketItem {
- int32 product_id = 2;
- int32 quantity = 6;
-}
-
-message UpdateBasketRequest {
- repeated BasketItem items = 2;
-}
-
-message DeleteBasketRequest {
-}
-
-message DeleteBasketResponse {
-}
\ No newline at end of file
diff --git a/src/ClientApp/Services/Catalog/CatalogMockService.cs b/src/ClientApp/Services/Catalog/CatalogMockService.cs
deleted file mode 100644
index 0f19e10c0..000000000
--- a/src/ClientApp/Services/Catalog/CatalogMockService.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-using eShop.ClientApp.Models.Catalog;
-
-namespace eShop.ClientApp.Services.Catalog;
-
-public class CatalogMockService : ICatalogService
-{
- private static readonly List MockCatalogBrands =
- new() {new CatalogBrand {Id = 1, Brand = "Azure"}, new CatalogBrand {Id = 2, Brand = "Visual Studio"}};
-
- private static readonly List MockCatalogTypes =
- new() {new CatalogType {Id = 1, Type = "Mug"}, new CatalogType {Id = 2, Type = "T-Shirt"}};
-
- private static readonly List MockCatalog =
- new()
- {
- new CatalogItem
- {
- Id = Common.Common.MockCatalogItemId01,
- PictureUri = "fake_product_01.png",
- Name = "Adventurer GPS Watch",
- Price = 199.99M,
- CatalogBrandId = 2,
- CatalogBrand = MockCatalogBrands[1],
- CatalogTypeId = 2,
- CatalogType = MockCatalogTypes[1],
- Description = "Navigate with confidence using the Adventurer GPS Watch by Adventurer. This rugged and durable watch features a built-in GPS, altimeter, and compass, allowing you to track your progress and find your way in any terrain. With its sleek black design and easy-to-read display, this watch is both stylish and practical. The Adventurer GPS Watch is a must-have for every adventurer."
- },
- new CatalogItem
- {
- Id = Common.Common.MockCatalogItemId02,
- PictureUri = "fake_product_02.png",
- Name = "AeroLite Cycling Helmet",
- Price = 129.99M,
- CatalogBrandId = 2,
- CatalogBrand = MockCatalogBrands[1],
- CatalogTypeId = 2,
- CatalogType = MockCatalogTypes[1],
- Description = "Stay safe on your cycling adventures with the Trailblazer Bike Helmet by Green Equipment. This lightweight and durable helmet features an adjustable fit system and ventilation for added comfort. With its vibrant green color and sleek design, you'll stand out on the road. The Trailblazer Bike Helmet is perfect for all types of cycling, from mountain biking to road cycling."
- },
- new CatalogItem
- {
- Id = Common.Common.MockCatalogItemId03,
- PictureUri = "fake_product_03.png",
- Name = "Alpine AlpinePack Backpack",
- Price = 129.00M,
- CatalogBrandId = 2,
- CatalogBrand = MockCatalogBrands[1],
- CatalogTypeId = 2,
- CatalogType = MockCatalogTypes[1],
- Description = "The AlpinePack backpack by Green Equipment is your ultimate companion for outdoor adventures. This versatile and durable backpack features a sleek navy design with reinforced straps. With a capacity of 45 liters, multiple compartments, and a hydration pack sleeve, it offers ample storage and organization. The ergonomic back panel ensures maximum comfort, even on the most challenging treks."
- },
- new CatalogItem
- {
- Id = Common.Common.MockCatalogItemId04,
- PictureUri = "fake_product_04.png",
- Name = "Alpine Fusion Goggles",
- Price = 79.99M,
- CatalogBrandId = 2,
- CatalogBrand = MockCatalogBrands[1],
- CatalogTypeId = 1,
- CatalogType = MockCatalogTypes[0],
- Description = "Enhance your skiing experience with the Alpine Fusion Goggles from WildRunner. These goggles offer full UV protection and anti-fog lenses to keep your vision clear on the slopes. With their stylish silver frame and orange lenses, you'll stand out from the crowd. Adjustable straps ensure a secure fit, while the soft foam padding provides comfort all day long."
- },
- new CatalogItem
- {
- Id = Common.Common.MockCatalogItemId05,
- PictureUri = "fake_product_05.png",
- Name = "Alpine PeakDown Jacket",
- Price = 249.99M,
- CatalogBrandId = 1,
- CatalogBrand = MockCatalogBrands[0],
- CatalogTypeId = 2,
- CatalogType = MockCatalogTypes[1],
- Description = "The Solstix Alpine Peak Down Jacket is crafted for extreme cold conditions. With its bold red color and sleek design, this jacket combines style with functionality. Made with high-quality goose down insulation, the Alpine Peak Jacket provides exceptional warmth and comfort. The jacket features a removable hood, adjustable cuffs, and multiple zippered pockets for storage. Conquer the harshest weather with the Solstix Alpine Peak Down Jacket."
- }
- };
-
- public async Task> GetCatalogAsync()
- {
- await Task.Delay(10);
-
- return MockCatalog;
- }
-
- public async Task GetCatalogItemAsync(int catalogItemId)
- {
- await Task.Delay(10);
-
- return MockCatalog.FirstOrDefault(x => x.Id == catalogItemId);
- }
-
- public async Task> FilterAsync(int catalogBrandId, int catalogTypeId)
- {
- await Task.Delay(10);
-
- return MockCatalog
- .Where(
- c => c.CatalogBrandId == catalogBrandId &&
- c.CatalogTypeId == catalogTypeId)
- .ToArray();
- }
-
- public async Task> GetCatalogBrandAsync()
- {
- await Task.Delay(10);
-
- return MockCatalogBrands;
- }
-
- public async Task> GetCatalogTypeAsync()
- {
- await Task.Delay(10);
-
- return MockCatalogTypes;
- }
-}
diff --git a/src/ClientApp/Services/Catalog/CatalogService.cs b/src/ClientApp/Services/Catalog/CatalogService.cs
deleted file mode 100644
index 174690457..000000000
--- a/src/ClientApp/Services/Catalog/CatalogService.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-using eShop.ClientApp.Helpers;
-using eShop.ClientApp.Models.Catalog;
-using eShop.ClientApp.Services.FixUri;
-using eShop.ClientApp.Services.RequestProvider;
-using eShop.ClientApp.Services.Settings;
-
-namespace eShop.ClientApp.Services.Catalog;
-
-public class CatalogService : ICatalogService
-{
- private const string ApiUrlBase = "api/catalog";
- private const string ApiVersion = "api-version=2.0";
-
- private readonly IFixUriService _fixUriService;
- private readonly IRequestProvider _requestProvider;
- private readonly ISettingsService _settingsService;
-
- public CatalogService(ISettingsService settingsService, IRequestProvider requestProvider,
- IFixUriService fixUriService)
- {
- _settingsService = settingsService;
- _requestProvider = requestProvider;
- _fixUriService = fixUriService;
- }
-
- public async Task> FilterAsync(int catalogBrandId, int catalogTypeId)
- {
- var uri = UriHelper.CombineUri(_settingsService.GatewayCatalogEndpointBase,
- $"{ApiUrlBase}//items?type={catalogTypeId}&brand={catalogBrandId}&PageSize=100&PageIndex=0&{ApiVersion}");
-
- var catalog = await _requestProvider.GetAsync(uri).ConfigureAwait(false);
-
- return catalog?.Data ?? Enumerable.Empty();
- }
-
- public async Task> GetCatalogAsync()
- {
- var uri = UriHelper.CombineUri(_settingsService.GatewayCatalogEndpointBase, $"{ApiUrlBase}/items?PageSize=100&{ApiVersion}");
-
- var catalog = await _requestProvider.GetAsync(uri).ConfigureAwait(false);
-
- if (catalog?.Data != null)
- {
- _fixUriService.FixCatalogItemPictureUri(catalog.Data);
- return catalog.Data;
- }
-
- return Enumerable.Empty();
- }
-
- public async Task GetCatalogItemAsync(int catalogItemId)
- {
- var uri = UriHelper.CombineUri(_settingsService.GatewayCatalogEndpointBase,
- $"{ApiUrlBase}/items/{catalogItemId}?{ApiVersion}");
-
- var catalogItem = await _requestProvider.GetAsync(uri).ConfigureAwait(false);
-
- if (catalogItem != null)
- {
- _fixUriService.FixCatalogItemPictureUri(new[] {catalogItem});
- return catalogItem;
- }
-
- return default;
- }
-
- public async Task> GetCatalogBrandAsync()
- {
- var uri = UriHelper.CombineUri(_settingsService.GatewayCatalogEndpointBase, $"{ApiUrlBase}/catalogbrands?{ApiVersion}");
-
- var brands = await _requestProvider.GetAsync>(uri).ConfigureAwait(false);
-
- return brands?.ToArray() ?? Enumerable.Empty();
- }
-
- public async Task> GetCatalogTypeAsync()
- {
- var uri = UriHelper.CombineUri(_settingsService.GatewayCatalogEndpointBase, $"{ApiUrlBase}/catalogtypes?{ApiVersion}");
-
- var types = await _requestProvider.GetAsync>(uri).ConfigureAwait(false);
-
- return types?.ToArray() ?? Enumerable.Empty();
- }
-}
diff --git a/src/ClientApp/Services/Catalog/ICatalogService.cs b/src/ClientApp/Services/Catalog/ICatalogService.cs
deleted file mode 100644
index 1d8c7b326..000000000
--- a/src/ClientApp/Services/Catalog/ICatalogService.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using eShop.ClientApp.Models.Catalog;
-
-namespace eShop.ClientApp.Services.Catalog;
-
-public interface ICatalogService
-{
- Task> GetCatalogBrandAsync();
- Task> FilterAsync(int catalogBrandId, int catalogTypeId);
- Task> GetCatalogTypeAsync();
- Task> GetCatalogAsync();
-
- Task GetCatalogItemAsync(int catalogItemId);
-}
diff --git a/src/ClientApp/Services/Common/Common.cs b/src/ClientApp/Services/Common/Common.cs
deleted file mode 100644
index b51fa3139..000000000
--- a/src/ClientApp/Services/Common/Common.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace eShop.ClientApp.Services.Common;
-
-public static class Common
-{
- public static int MockCatalogItemId01 = 1;
- public static int MockCatalogItemId02 = 2;
- public static int MockCatalogItemId03 = 3;
- public static int MockCatalogItemId04 = 4;
- public static int MockCatalogItemId05 = 5;
-
- public static int MockCampaignId01 = 1;
- public static int MockCampaignId02 = 2;
-}
diff --git a/src/ClientApp/Services/Dialog/DialogService.cs b/src/ClientApp/Services/Dialog/DialogService.cs
deleted file mode 100644
index 6db4706d9..000000000
--- a/src/ClientApp/Services/Dialog/DialogService.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace eShop.ClientApp.Services;
-
-public class DialogService : IDialogService
-{
- public Task ShowAlertAsync(string message, string title, string buttonLabel)
- {
- return AppShell.Current.DisplayAlert(title, message, buttonLabel);
- }
-}
diff --git a/src/ClientApp/Services/Dialog/IDialogService.cs b/src/ClientApp/Services/Dialog/IDialogService.cs
deleted file mode 100644
index a5f3a23e2..000000000
--- a/src/ClientApp/Services/Dialog/IDialogService.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace eShop.ClientApp.Services;
-
-public interface IDialogService
-{
- Task ShowAlertAsync(string message, string title, string buttonLabel);
-}
diff --git a/src/ClientApp/Services/EShopJsonSerializerContext.cs b/src/ClientApp/Services/EShopJsonSerializerContext.cs
deleted file mode 100644
index a8a2b97e6..000000000
--- a/src/ClientApp/Services/EShopJsonSerializerContext.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System.Text.Json.Serialization;
-using eShop.ClientApp.Models.Catalog;
-using eShop.ClientApp.Models.Orders;
-using eShop.ClientApp.Models.Token;
-
-namespace eShop.ClientApp.Services;
-
-[JsonSourceGenerationOptions(
- PropertyNameCaseInsensitive = true,
- NumberHandling = JsonNumberHandling.AllowReadingFromString)]
-[JsonSerializable(typeof(CancelOrderCommand))]
-[JsonSerializable(typeof(CatalogBrand))]
-[JsonSerializable(typeof(CatalogItem))]
-[JsonSerializable(typeof(CatalogRoot))]
-[JsonSerializable(typeof(CatalogType))]
-[JsonSerializable(typeof(Models.Orders.Order))]
-[JsonSerializable(typeof(Models.Location.Location))]
-[JsonSerializable(typeof(UserToken))]
-internal partial class EShopJsonSerializerContext : JsonSerializerContext
-{
-}
diff --git a/src/ClientApp/Services/FixUri/FixUriService.cs b/src/ClientApp/Services/FixUri/FixUriService.cs
deleted file mode 100644
index d518b7688..000000000
--- a/src/ClientApp/Services/FixUri/FixUriService.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-using System.Diagnostics;
-using System.Text.RegularExpressions;
-using eShop.ClientApp.Models.Basket;
-using eShop.ClientApp.Models.Catalog;
-using eShop.ClientApp.Models.Marketing;
-using eShop.ClientApp.Services.Settings;
-
-namespace eShop.ClientApp.Services.FixUri;
-
-public class FixUriService : IFixUriService
-{
- private const string ApiVersion = "api-version=2.0";
-
- private readonly ISettingsService _settingsService;
-
- private readonly Regex IpRegex = new(@"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b");
-
- public FixUriService(ISettingsService settingsService)
- {
- _settingsService = settingsService;
- }
-
- public void FixCatalogItemPictureUri(IEnumerable catalogItems)
- {
- if (catalogItems is null)
- {
- return;
- }
-
- try
- {
- if (!_settingsService.UseMocks && _settingsService.GatewayCatalogEndpointBase != _settingsService.DefaultEndpoint)
- {
- foreach (var catalogItem in catalogItems)
- {
- catalogItem.PictureUri = Path.Combine(_settingsService.GatewayCatalogEndpointBase, $"api/catalog/items/{catalogItem.Id}/pic?{ApiVersion}");
- }
- }
- }
- catch (Exception ex)
- {
- Debug.WriteLine(ex.Message);
- }
- }
-
- public void FixBasketItemPictureUri(IEnumerable basketItems)
- {
- if (basketItems is null)
- {
- return;
- }
-
- try
- {
- if (!_settingsService.UseMocks && _settingsService.IdentityEndpointBase != _settingsService.DefaultEndpoint)
- {
- foreach (var basketItem in basketItems)
- {
- var serverResult = IpRegex.Matches(basketItem.PictureUrl);
- var localResult = IpRegex.Matches(_settingsService.IdentityEndpointBase);
-
- if (serverResult.Count != -1 && localResult.Count != -1)
- {
- var serviceIp = serverResult[0].Value;
- var localIp = localResult[0].Value;
- basketItem.PictureUrl = basketItem.PictureUrl.Replace(serviceIp, localIp);
- }
- }
- }
- }
- catch (Exception ex)
- {
- Debug.WriteLine(ex.Message);
- }
- }
-
- public void FixCampaignItemPictureUri(IEnumerable campaignItems)
- {
- if (campaignItems is null)
- {
- return;
- }
-
- try
- {
- if (!_settingsService.UseMocks && _settingsService.IdentityEndpointBase != _settingsService.DefaultEndpoint)
- {
- foreach (var campaignItem in campaignItems)
- {
- var serverResult = IpRegex.Matches(campaignItem.PictureUri);
- var localResult = IpRegex.Matches(_settingsService.IdentityEndpointBase);
-
- if (serverResult.Count != -1 && localResult.Count != -1)
- {
- var serviceIp = serverResult[0].Value;
- var localIp = localResult[0].Value;
-
- campaignItem.PictureUri = campaignItem.PictureUri.Replace(serviceIp, localIp);
- }
- }
- }
- }
- catch (Exception ex)
- {
- Debug.WriteLine(ex.Message);
- }
- }
-}
diff --git a/src/ClientApp/Services/FixUri/IFixUriService.cs b/src/ClientApp/Services/FixUri/IFixUriService.cs
deleted file mode 100644
index 6420adbd7..000000000
--- a/src/ClientApp/Services/FixUri/IFixUriService.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using eShop.ClientApp.Models.Basket;
-using eShop.ClientApp.Models.Catalog;
-using eShop.ClientApp.Models.Marketing;
-
-namespace eShop.ClientApp.Services.FixUri;
-
-public interface IFixUriService
-{
- void FixCatalogItemPictureUri(IEnumerable catalogItems);
- void FixBasketItemPictureUri(IEnumerable basketItems);
- void FixCampaignItemPictureUri(IEnumerable campaignItems);
-}
diff --git a/src/ClientApp/Services/Identity/AuthorizeRequest.cs b/src/ClientApp/Services/Identity/AuthorizeRequest.cs
deleted file mode 100644
index bf87761b5..000000000
--- a/src/ClientApp/Services/Identity/AuthorizeRequest.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System.Net;
-
-namespace eShop.ClientApp.Services.Identity;
-
-public class AuthorizeRequest
-{
- private readonly Uri _authorizeEndpoint;
-
- public AuthorizeRequest(string authorizeEndpoint)
- {
- _authorizeEndpoint = new Uri(authorizeEndpoint);
- }
-
- public string Create(IDictionary values)
- {
- var queryString = string.Join("&",
- values.Select(kvp =>
- string.Format("{0}={1}", WebUtility.UrlEncode(kvp.Key), WebUtility.UrlEncode(kvp.Value))).ToArray());
- return string.Format("{0}?{1}", _authorizeEndpoint.AbsoluteUri, queryString);
- }
-}
diff --git a/src/ClientApp/Services/Identity/IIdentityService.cs b/src/ClientApp/Services/Identity/IIdentityService.cs
deleted file mode 100644
index 485981675..000000000
--- a/src/ClientApp/Services/Identity/IIdentityService.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using eShop.ClientApp.Models.User;
-
-namespace eShop.ClientApp.Services.Identity;
-
-public interface IIdentityService
-{
- Task SignInAsync();
-
- Task SignOutAsync();
-
- Task GetUserInfoAsync();
-
- Task GetAuthTokenAsync();
-}
diff --git a/src/ClientApp/Services/Identity/IdentityMockService.cs b/src/ClientApp/Services/Identity/IdentityMockService.cs
deleted file mode 100644
index 4e06f6f79..000000000
--- a/src/ClientApp/Services/Identity/IdentityMockService.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using eShop.ClientApp.Models.User;
-
-namespace eShop.ClientApp.Services.Identity;
-
-public class IdentityMockService : IIdentityService
-{
- private bool _signedIn;
-
- public Task SignInAsync()
- {
- _signedIn = true;
- return Task.FromResult(_signedIn);
- }
-
- public Task SignOutAsync()
- {
- _signedIn = false;
- return Task.FromResult(_signedIn);
- }
-
- public Task GetUserInfoAsync()
- {
- if (!_signedIn)
- {
- return Task.FromResult(UserInfo.Default);
- }
-
- return Task.FromResult(new UserInfo
- {
- UserId = Guid.NewGuid().ToString(),
- PreferredUsername = "sampleUser",
- Name = "Sample",
- LastName = "User",
- CardNumber = "XXXXXXXXXXXX3456",
- CardHolder = "Sample User",
- CardSecurityNumber = "123",
- Address = "123 Sample Street",
- Country = "USA",
- State = "Washington",
- Street = "123 Sample Street",
- ZipCode = "12345",
- Email = "sample.user@example.com",
- EmailVerified = true,
- PhoneNumber = "1234567890",
- PhoneNumberVerified = true
- });
- }
-
- public Task GetAuthTokenAsync()
- {
- if (!_signedIn)
- {
- return Task.FromResult(string.Empty);
- }
-
- return Task.FromResult(Guid.NewGuid().ToString());
- }
-}
diff --git a/src/ClientApp/Services/Identity/IdentityService.cs b/src/ClientApp/Services/Identity/IdentityService.cs
deleted file mode 100644
index 086759e26..000000000
--- a/src/ClientApp/Services/Identity/IdentityService.cs
+++ /dev/null
@@ -1,153 +0,0 @@
-using eShop.ClientApp.Models.Token;
-using eShop.ClientApp.Models.User;
-using eShop.ClientApp.Services.Settings;
-using IdentityModel.OidcClient;
-using IBrowser = IdentityModel.OidcClient.Browser.IBrowser;
-
-namespace eShop.ClientApp.Services.Identity;
-
-public class IdentityService : IIdentityService
-{
- private readonly IBrowser _browser;
- private readonly ISettingsService _settingsService;
- private readonly HttpMessageHandler _httpMessageHandler;
-
- public IdentityService(IBrowser browser, ISettingsService settingsService, HttpMessageHandler httpMessageHandler)
- {
- _browser = browser;
- _settingsService = settingsService;
- _httpMessageHandler = httpMessageHandler;
- }
-
- public async Task SignInAsync()
- {
- var response = await GetClient().LoginAsync(new LoginRequest()).ConfigureAwait(false);
-
- if (response.IsError)
- {
- return false;
- }
-
- await _settingsService
- .SetUserTokenAsync(
- new UserToken
- {
- AccessToken = response.AccessToken,
- IdToken = response.IdentityToken,
- RefreshToken = response.RefreshToken,
- ExpiresAt = response.AccessTokenExpiration
- })
- .ConfigureAwait(false);
-
- return !response.IsError;
- }
-
- public async Task SignOutAsync()
- {
- var response = await GetClient().LogoutAsync(new LogoutRequest()).ConfigureAwait(false);
-
- if (response.IsError)
- {
- return false;
- }
-
- await _settingsService.SetUserTokenAsync(default);
-
- return !response.IsError;
- }
-
- public async Task GetUserInfoAsync()
- {
- var authToken = await GetAuthTokenAsync().ConfigureAwait(false);
-
- if (string.IsNullOrEmpty(authToken))
- {
- return UserInfo.Default;
- }
-
- var userInfoWithClaims = await GetClient().GetUserInfoAsync(authToken).ConfigureAwait(false);
-
- return
- new UserInfo
- {
- UserId = userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "sub")?.Value,
- Email = userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "email")?.Value,
- PhoneNumber = userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "phone_number")?.Value,
- Street = userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "address_street")?.Value,
- Address = userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "address_city")?.Value,
- State = userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "address_state")?.Value,
- ZipCode = userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "address_zip_code")?.Value,
- Country = userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "address_country")?.Value,
- PreferredUsername =
- userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "preferred_username")?.Value,
- Name = userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "name")?.Value,
- LastName = userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "last_name")?.Value,
- CardNumber = userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "card_number")?.Value,
- CardHolder = userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "card_holder")?.Value,
- CardSecurityNumber =
- userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "card_security_number")?.Value,
- PhoneNumberVerified =
- bool.Parse(userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "phone_number_verified")
- ?.Value ?? "false"),
- EmailVerified =
- bool.Parse(userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "email_verified")?.Value ??
- "false")
- };
- }
-
- public async Task GetAuthTokenAsync()
- {
- var userToken = await _settingsService.GetUserTokenAsync().ConfigureAwait(false);
-
- if (userToken is null)
- {
- return string.Empty;
- }
-
- if (userToken.ExpiresAt.Subtract(DateTimeOffset.Now).TotalMinutes > 5)
- {
- return userToken.AccessToken;
- }
-
- var response = await GetClient().RefreshTokenAsync(userToken.RefreshToken).ConfigureAwait(false);
-
- if (response.IsError)
- {
- return string.Empty;
- }
-
- await _settingsService
- .SetUserTokenAsync(
- new UserToken
- {
- AccessToken = response.AccessToken,
- IdToken = response.IdentityToken,
- RefreshToken = response.RefreshToken,
- ExpiresAt = response.AccessTokenExpiration
- })
- .ConfigureAwait(false);
-
- return response.AccessToken;
- }
-
- private OidcClient GetClient()
- {
- var options = new OidcClientOptions
- {
- Authority = _settingsService.IdentityEndpointBase,
- ClientId = _settingsService.ClientId,
- ClientSecret = _settingsService.ClientSecret,
- Scope = "openid profile basket orders offline_access",
- RedirectUri = _settingsService.CallbackUri,
- PostLogoutRedirectUri = _settingsService.CallbackUri,
- Browser = _browser,
- };
-
- if (_httpMessageHandler is not null)
- {
- options.BackchannelHandler = _httpMessageHandler;
- }
-
- return new OidcClient(options);
- }
-}
diff --git a/src/ClientApp/Services/Location/ILocationService.cs b/src/ClientApp/Services/Location/ILocationService.cs
deleted file mode 100644
index 9a6b9284c..000000000
--- a/src/ClientApp/Services/Location/ILocationService.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace eShop.ClientApp.Services.Location;
-
-public interface ILocationService
-{
- Task UpdateUserLocation(Models.Location.Location newLocReq);
-}
diff --git a/src/ClientApp/Services/Location/LocationService.cs b/src/ClientApp/Services/Location/LocationService.cs
deleted file mode 100644
index 9e21f6564..000000000
--- a/src/ClientApp/Services/Location/LocationService.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using eShop.ClientApp.Services.Identity;
-using eShop.ClientApp.Services.RequestProvider;
-using eShop.ClientApp.Services.Settings;
-
-namespace eShop.ClientApp.Services.Location;
-
-public class LocationService : ILocationService
-{
- private const string ApiUrlBase = "l/api/v1/locations";
- private readonly IIdentityService _identityService;
-
- public LocationService(IIdentityService identityService)
- {
- _identityService = identityService;
- }
-
- public async Task UpdateUserLocation(Models.Location.Location newLocReq)
- {
- var accessToken = await _identityService.GetAuthTokenAsync().ConfigureAwait(false);
-
- if (string.IsNullOrEmpty(accessToken))
- {
- return;
- }
-
- //TODO: Determine mapped location
- await Task.Delay(10).ConfigureAwait(false);
- //await _requestProvider.PostAsync(uri, newLocReq, token).ConfigureAwait(false);
- }
-}
diff --git a/src/ClientApp/Services/Navigation/INavigationService.cs b/src/ClientApp/Services/Navigation/INavigationService.cs
deleted file mode 100644
index 5aac92b71..000000000
--- a/src/ClientApp/Services/Navigation/INavigationService.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace eShop.ClientApp.Services;
-
-public interface INavigationService
-{
- Task InitializeAsync();
-
- Task NavigateToAsync(string route, IDictionary routeParameters = null);
-
- Task PopAsync();
-}
diff --git a/src/ClientApp/Services/Navigation/MauiNavigationService.cs b/src/ClientApp/Services/Navigation/MauiNavigationService.cs
deleted file mode 100644
index 393c7ba80..000000000
--- a/src/ClientApp/Services/Navigation/MauiNavigationService.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using eShop.ClientApp.Models.User;
-using eShop.ClientApp.Services.AppEnvironment;
-
-namespace eShop.ClientApp.Services;
-
-public class MauiNavigationService : INavigationService
-{
- private readonly IAppEnvironmentService _appEnvironmentService;
-
- public MauiNavigationService(IAppEnvironmentService appEnvironmentService)
- {
- _appEnvironmentService = appEnvironmentService;
- }
-
- public async Task InitializeAsync()
- {
- var user = await _appEnvironmentService.IdentityService.GetUserInfoAsync();
-
- await NavigateToAsync(user == UserInfo.Default ? "//Login" : "//Main/Catalog");
- }
-
- public Task NavigateToAsync(string route, IDictionary routeParameters = null)
- {
- var shellNavigation = new ShellNavigationState(route);
-
- return routeParameters != null
- ? Shell.Current.GoToAsync(shellNavigation, routeParameters)
- : Shell.Current.GoToAsync(shellNavigation);
- }
-
- public Task PopAsync()
- {
- return Shell.Current.GoToAsync("..");
- }
-}
diff --git a/src/ClientApp/Services/OpenUrl/IOpenUrlService.cs b/src/ClientApp/Services/OpenUrl/IOpenUrlService.cs
deleted file mode 100644
index fffd2d1bd..000000000
--- a/src/ClientApp/Services/OpenUrl/IOpenUrlService.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace eShop.ClientApp.Services.OpenUrl;
-
-public interface IOpenUrlService
-{
- Task OpenUrl(string url);
-}
diff --git a/src/ClientApp/Services/OpenUrl/OpenUrlService.cs b/src/ClientApp/Services/OpenUrl/OpenUrlService.cs
deleted file mode 100644
index 53ee914f3..000000000
--- a/src/ClientApp/Services/OpenUrl/OpenUrlService.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace eShop.ClientApp.Services.OpenUrl;
-
-public class OpenUrlService : IOpenUrlService
-{
- public async Task OpenUrl(string url)
- {
- if (await Launcher.CanOpenAsync(url))
- {
- await Launcher.OpenAsync(url);
- }
- }
-}
diff --git a/src/ClientApp/Services/Order/IOrderService.cs b/src/ClientApp/Services/Order/IOrderService.cs
deleted file mode 100644
index 36608a1fd..000000000
--- a/src/ClientApp/Services/Order/IOrderService.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using eShop.ClientApp.Models.Basket;
-
-namespace eShop.ClientApp.Services.Order;
-
-public interface IOrderService
-{
- Task CreateOrderAsync(Models.Orders.Order newOrder);
-
- Task> GetOrdersAsync();
-
- Task GetOrderAsync(int orderId);
-
- Task CancelOrderAsync(int orderId);
-
- OrderCheckout MapOrderToBasket(Models.Orders.Order order);
-}
diff --git a/src/ClientApp/Services/Order/OrderMockService.cs b/src/ClientApp/Services/Order/OrderMockService.cs
deleted file mode 100644
index f18219415..000000000
--- a/src/ClientApp/Services/Order/OrderMockService.cs
+++ /dev/null
@@ -1,187 +0,0 @@
-using eShop.ClientApp.Models.Basket;
-using eShop.ClientApp.Models.Orders;
-using eShop.ClientApp.Models.User;
-
-namespace eShop.ClientApp.Services.Order;
-
-public class OrderMockService : IOrderService
-{
- private static readonly DateTime MockExpirationDate = DateTime.Now.AddYears(5);
-
- private static readonly Address MockAdress = new()
- {
- Id = Guid.NewGuid(),
- City = "Seattle, WA",
- Street = "120 E 87th Street",
- CountryCode = "98122",
- Country = "United States",
- Latitude = 40.785091,
- Longitude = -73.968285,
- State = "Seattle",
- StateCode = "WA",
- ZipCode = "98101"
- };
-
- private static readonly PaymentInfo MockPaymentInfo = new()
- {
- Id = Guid.NewGuid(),
- CardHolderName = "American Express",
- CardNumber = "XXXXXXXXXXXX0005",
- CardType = new CardType
- {
- Id = 3,
- Name = "MasterCard"
- },
- Expiration = MockExpirationDate.ToString(),
- ExpirationMonth = MockExpirationDate.Month,
- ExpirationYear = MockExpirationDate.Year,
- SecurityNumber = "123"
- };
-
- private static readonly List MockOrderItems = new()
- {
- new OrderItem
- {
- OrderId = Guid.NewGuid(),
- ProductId = Common.Common.MockCatalogItemId01,
- Discount = 15,
- ProductName = ".NET Bot Blue Sweatshirt (M)",
- Quantity = 1,
- UnitPrice = 16.50M,
- PictureUrl = "fake_product_01.png"
- },
- new OrderItem
- {
- OrderId = Guid.NewGuid(),
- ProductId = Common.Common.MockCatalogItemId03,
- Discount = 0,
- ProductName = ".NET Bot Black Sweatshirt (M)",
- Quantity = 2,
- UnitPrice = 19.95M,
- PictureUrl = "fake_product_03.png"
- }
- };
-
- private static readonly OrderCheckout MockOrderCheckout = new()
- {
- CardExpiration = DateTime.UtcNow,
- CardHolderName = "FakeCardHolderName",
- CardNumber = "XXXXXXXXXXXX3224",
- CardSecurityNumber = "1234",
- CardTypeId = 1,
- City = "FakeCity",
- Country = "FakeCountry",
- ZipCode = "FakeZipCode",
- Street = "FakeStreet"
- };
-
- private readonly List MockOrders = new()
- {
- new Models.Orders.Order
- {
- OrderNumber = 1,
- SequenceNumber = 123,
- OrderDate = DateTime.Now,
- OrderStatus = "Submitted",
- OrderItems = MockOrderItems,
- CardTypeId = MockPaymentInfo.CardType.Id,
- CardHolderName = MockPaymentInfo.CardHolderName,
- CardNumber = MockPaymentInfo.CardNumber,
- CardSecurityNumber = MockPaymentInfo.SecurityNumber,
- CardExpiration = new DateTime(MockPaymentInfo.ExpirationYear, MockPaymentInfo.ExpirationMonth, 1),
- ShippingCity = MockAdress.City,
- ShippingState = MockAdress.State,
- ShippingCountry = MockAdress.Country,
- ShippingStreet = MockAdress.Street,
- Total = 36.46M
- },
- new Models.Orders.Order
- {
- OrderNumber = 2,
- SequenceNumber = 132,
- OrderDate = DateTime.Now,
- OrderStatus = "Paid",
- OrderItems = MockOrderItems,
- CardTypeId = MockPaymentInfo.CardType.Id,
- CardHolderName = MockPaymentInfo.CardHolderName,
- CardNumber = MockPaymentInfo.CardNumber,
- CardSecurityNumber = MockPaymentInfo.SecurityNumber,
- CardExpiration = new DateTime(MockPaymentInfo.ExpirationYear, MockPaymentInfo.ExpirationMonth, 1),
- ShippingCity = MockAdress.City,
- ShippingState = MockAdress.State,
- ShippingCountry = MockAdress.Country,
- ShippingStreet = MockAdress.Street,
- Total = 36.46M
- },
- new Models.Orders.Order
- {
- OrderNumber = 3,
- SequenceNumber = 231,
- OrderDate = DateTime.Now,
- OrderStatus = "Cancelled",
- OrderItems = MockOrderItems,
- CardTypeId = MockPaymentInfo.CardType.Id,
- CardHolderName = MockPaymentInfo.CardHolderName,
- CardNumber = MockPaymentInfo.CardNumber,
- CardSecurityNumber = MockPaymentInfo.SecurityNumber,
- CardExpiration = new DateTime(MockPaymentInfo.ExpirationYear, MockPaymentInfo.ExpirationMonth, 1),
- ShippingCity = MockAdress.City,
- ShippingState = MockAdress.State,
- ShippingCountry = MockAdress.Country,
- ShippingStreet = MockAdress.Street,
- Total = 36.46M
- },
- new Models.Orders.Order
- {
- OrderNumber = 4,
- SequenceNumber = 131,
- OrderDate = DateTime.Now,
- OrderStatus = "Shipped",
- OrderItems = MockOrderItems,
- CardTypeId = MockPaymentInfo.CardType.Id,
- CardHolderName = MockPaymentInfo.CardHolderName,
- CardNumber = MockPaymentInfo.CardNumber,
- CardSecurityNumber = MockPaymentInfo.SecurityNumber,
- CardExpiration = new DateTime(MockPaymentInfo.ExpirationYear, MockPaymentInfo.ExpirationMonth, 1),
- ShippingCity = MockAdress.City,
- ShippingState = MockAdress.State,
- ShippingCountry = MockAdress.Country,
- ShippingStreet = MockAdress.Street,
- Total = 36.46M
- }
- };
-
- public async Task> GetOrdersAsync()
- {
- await Task.Delay(10);
-
- return MockOrders
- .OrderByDescending(o => o.OrderNumber)
- .ToArray();
- }
-
- public async Task GetOrderAsync(int orderId)
- {
- await Task.Delay(10);
-
- return MockOrders
- .FirstOrDefault(o => o.OrderNumber.Equals(orderId));
- }
-
- public async Task CreateOrderAsync(Models.Orders.Order newOrder)
- {
- await Task.Delay(10);
-
- MockOrders.Add(newOrder);
- }
-
- public OrderCheckout MapOrderToBasket(Models.Orders.Order order)
- {
- return MockOrderCheckout;
- }
-
- public Task CancelOrderAsync(int orderId)
- {
- return Task.FromResult(true);
- }
-}
diff --git a/src/ClientApp/Services/Order/OrderService.cs b/src/ClientApp/Services/Order/OrderService.cs
deleted file mode 100644
index d7f6a9887..000000000
--- a/src/ClientApp/Services/Order/OrderService.cs
+++ /dev/null
@@ -1,128 +0,0 @@
-using System.Net;
-using eShop.ClientApp.Helpers;
-using eShop.ClientApp.Models.Basket;
-using eShop.ClientApp.Models.Orders;
-using eShop.ClientApp.Services.Identity;
-using eShop.ClientApp.Services.RequestProvider;
-using eShop.ClientApp.Services.Settings;
-
-namespace eShop.ClientApp.Services.Order;
-
-public class OrderService : IOrderService
-{
- private const string ApiUrlBase = "api/orders";
- private const string ApiVersion = "api-version=1.0";
-
- private readonly IIdentityService _identityService;
- private readonly IRequestProvider _requestProvider;
- private readonly ISettingsService _settingsService;
-
- public OrderService(IIdentityService identityService, ISettingsService settingsService,
- IRequestProvider requestProvider)
- {
- _identityService = identityService;
- _settingsService = settingsService;
- _requestProvider = requestProvider;
- }
-
- public async Task CreateOrderAsync(Models.Orders.Order newOrder)
- {
- var authToken = await _identityService.GetAuthTokenAsync().ConfigureAwait(false);
-
- if (string.IsNullOrEmpty(authToken))
- {
- return;
- }
-
- var uri = $"{UriHelper.CombineUri(_settingsService.GatewayOrdersEndpointBase, ApiUrlBase)}?{ApiVersion}";
-
- var success = await _requestProvider.PostAsync(uri, newOrder, authToken, "x-requestid").ConfigureAwait(false);
- }
-
- public async Task> GetOrdersAsync()
- {
- var authToken = await _identityService.GetAuthTokenAsync().ConfigureAwait(false);
-
- if (string.IsNullOrEmpty(authToken))
- {
- return Enumerable.Empty();
- }
-
- var uri = $"{UriHelper.CombineUri(_settingsService.GatewayOrdersEndpointBase, ApiUrlBase)}?{ApiVersion}";
-
- var orders =
- await _requestProvider.GetAsync>(uri, authToken).ConfigureAwait(false);
-
- return orders ?? Enumerable.Empty();
- }
-
- public async Task GetOrderAsync(int orderId)
- {
- var authToken = await _identityService.GetAuthTokenAsync().ConfigureAwait(false);
-
- if (string.IsNullOrEmpty(authToken))
- {
- return new Models.Orders.Order();
- }
-
- try
- {
- var uri = $"{UriHelper.CombineUri(_settingsService.GatewayOrdersEndpointBase, $"{ApiUrlBase}/{orderId}")}?{ApiVersion}";
-
- var order =
- await _requestProvider.GetAsync(uri, authToken).ConfigureAwait(false);
-
- return order;
- }
- catch
- {
- return new Models.Orders.Order();
- }
- }
-
- public async Task CancelOrderAsync(int orderId)
- {
- var authToken = await _identityService.GetAuthTokenAsync().ConfigureAwait(false);
-
- if (string.IsNullOrEmpty(authToken))
- {
- return false;
- }
-
- var uri = $"{UriHelper.CombineUri(_settingsService.GatewayOrdersEndpointBase, $"{ApiUrlBase}/cancel")}?{ApiVersion}";
-
- var cancelOrderCommand = new CancelOrderCommand(orderId);
-
- var header = "x-requestid";
-
- try
- {
- await _requestProvider.PutAsync(uri, cancelOrderCommand, authToken, header).ConfigureAwait(false);
- }
- //If the status of the order has changed before to click cancel button, we will get
- //a BadRequest HttpStatus
- catch (HttpRequestExceptionEx ex) when (ex.HttpCode == HttpStatusCode.BadRequest)
- {
- return false;
- }
-
- return true;
- }
-
- public OrderCheckout MapOrderToBasket(Models.Orders.Order order)
- {
- return new OrderCheckout
- {
- CardExpiration = order.CardExpiration,
- CardHolderName = order.CardHolderName,
- CardNumber = order.CardNumber,
- CardSecurityNumber = order.CardSecurityNumber,
- CardTypeId = order.CardTypeId,
- City = order.ShippingCity,
- State = order.ShippingState,
- Country = order.ShippingCountry,
- ZipCode = order.ShippingZipCode,
- Street = order.ShippingStreet
- };
- }
-}
diff --git a/src/ClientApp/Services/RequestProvider/HttpRequestExceptionEx.cs b/src/ClientApp/Services/RequestProvider/HttpRequestExceptionEx.cs
deleted file mode 100644
index 6eeecf0d9..000000000
--- a/src/ClientApp/Services/RequestProvider/HttpRequestExceptionEx.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System.Net;
-
-namespace eShop.ClientApp.Services.RequestProvider;
-
-public class HttpRequestExceptionEx : HttpRequestException
-{
- public HttpRequestExceptionEx(HttpStatusCode code) : this(code, null, null)
- {
- }
-
- public HttpRequestExceptionEx(HttpStatusCode code, string message) : this(code, message, null)
- {
- }
-
- public HttpRequestExceptionEx(HttpStatusCode code, string message, Exception inner) : base(message, inner)
- {
- HttpCode = code;
- }
-
- public HttpStatusCode HttpCode { get; }
-}
diff --git a/src/ClientApp/Services/RequestProvider/IRequestProvider.cs b/src/ClientApp/Services/RequestProvider/IRequestProvider.cs
deleted file mode 100644
index 919205b26..000000000
--- a/src/ClientApp/Services/RequestProvider/IRequestProvider.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-namespace eShop.ClientApp.Services.RequestProvider;
-
-public interface IRequestProvider
-{
- Task GetAsync(string uri, string token = "");
-
- Task PostAsync(string uri, TRequest data, string token = "", string header = "");
-
- Task PostAsync(string uri, TRequest data, string token = "", string header = "");
-
- Task PostAsync(string uri, string data, string clientId, string clientSecret);
-
- Task PutAsync(string uri, TResult data, string token = "", string header = "");
-
- Task DeleteAsync(string uri, string token = "");
-}
diff --git a/src/ClientApp/Services/RequestProvider/RequestProvider.cs b/src/ClientApp/Services/RequestProvider/RequestProvider.cs
deleted file mode 100644
index 2f5f7f3df..000000000
--- a/src/ClientApp/Services/RequestProvider/RequestProvider.cs
+++ /dev/null
@@ -1,181 +0,0 @@
-#nullable enable
-using System.Net;
-using System.Net.Http.Headers;
-using System.Net.Http.Json;
-using System.Text.Json;
-using eShop.ClientApp.Exceptions;
-
-namespace eShop.ClientApp.Services.RequestProvider;
-
-public class RequestProvider(HttpMessageHandler _messageHandler) : IRequestProvider
-{
- private readonly Lazy _httpClient =
- new(() =>
- {
- var httpClient = _messageHandler is not null ? new HttpClient(_messageHandler) : new HttpClient();
- httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
- return httpClient;
- },
- LazyThreadSafetyMode.ExecutionAndPublication);
-
- public async Task GetAsync(string uri, string token = "")
- {
- var httpClient = GetOrCreateHttpClient(token);
- using var response = await httpClient.GetAsync(uri).ConfigureAwait(false);
-
- await HandleResponse(response).ConfigureAwait(false);
-
- var result = await ReadFromJsonAsync(response.Content).ConfigureAwait(false);
-
- return result;
- }
-
- public async Task PostAsync(string uri, TRequest data, string token = "", string header = "")
- {
- var httpClient = GetOrCreateHttpClient(token);
-
- if (!string.IsNullOrEmpty(header))
- {
- AddHeaderParameter(httpClient, header);
- }
-
- var requestContent = SerializeToJson(data);
- using HttpResponseMessage response = await httpClient.PostAsync(uri, requestContent).ConfigureAwait(false);
-
- await HandleResponse(response).ConfigureAwait(false);
- var result = await ReadFromJsonAsync(response.Content).ConfigureAwait(false);
-
- return result;
- }
-
- public async Task PostAsync(string uri, TRequest data, string token = "", string header = "")
- {
- var httpClient = GetOrCreateHttpClient(token);
-
- if (!string.IsNullOrEmpty(header))
- {
- AddHeaderParameter(httpClient, header);
- }
-
- var requestContent = SerializeToJson(data);
- using var response = await httpClient.PostAsync(uri, requestContent).ConfigureAwait(false);
-
- await HandleResponse(response).ConfigureAwait(false);
-
- return response.IsSuccessStatusCode;
- }
-
- public async Task PostAsync