diff --git a/Single_Page_Anwendung/ClientApp/angular.json b/Single_Page_Anwendung/ClientApp/angular.json
index c9a2008..e096e3e 100644
--- a/Single_Page_Anwendung/ClientApp/angular.json
+++ b/Single_Page_Anwendung/ClientApp/angular.json
@@ -22,7 +22,6 @@
"tsConfig": "src/tsconfig.app.json",
"assets": ["src/assets"],
"styles": [
- "node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.css"
],
"scripts": []
diff --git a/Single_Page_Anwendung/ClientApp/package.json b/Single_Page_Anwendung/ClientApp/package.json
index fb4cd14..be1bca2 100644
--- a/Single_Page_Anwendung/ClientApp/package.json
+++ b/Single_Page_Anwendung/ClientApp/package.json
@@ -23,12 +23,9 @@
"@angular/router": "8.2.12",
"@nguniversal/module-map-ngfactory-loader": "8.1.1",
"aspnet-prerendering": "^3.0.1",
- "bootstrap": "^4.6.0",
"core-js": "^3.8.3",
- "jquery": "^3.6.0",
"node-sass": "^5.0.0",
"oidc-client": "^1.11.5",
- "popper.js": "^1.16.0",
"protractor": "~5.4.2",
"rxjs": "^6.6.3",
"ts-node": "~8.4.1",
diff --git a/Single_Page_Anwendung/ClientApp/src/app/app.module.ts b/Single_Page_Anwendung/ClientApp/src/app/app.module.ts
index 908d0c7..3a3d887 100644
--- a/Single_Page_Anwendung/ClientApp/src/app/app.module.ts
+++ b/Single_Page_Anwendung/ClientApp/src/app/app.module.ts
@@ -7,16 +7,14 @@ import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
import { NavMenuComponent } from './nav-menu/nav-menu.component';
import { HomeComponent } from './home/home.component';
-import { CounterComponent } from './counter/counter.component';
-import { FetchDataComponent } from './fetch-data/fetch-data.component';
+
@NgModule({
declarations: [
AppComponent,
NavMenuComponent,
HomeComponent,
- CounterComponent,
- FetchDataComponent
+
],
imports: [
BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }),
@@ -24,8 +22,6 @@ import { FetchDataComponent } from './fetch-data/fetch-data.component';
FormsModule,
RouterModule.forRoot([
{ path: '', component: HomeComponent, pathMatch: 'full' },
- { path: 'counter', component: CounterComponent },
- { path: 'fetch-data', component: FetchDataComponent },
])
],
providers: [],
diff --git a/Single_Page_Anwendung/ClientApp/src/app/counter/counter.component.html b/Single_Page_Anwendung/ClientApp/src/app/counter/counter.component.html
deleted file mode 100644
index 89b9c80..0000000
--- a/Single_Page_Anwendung/ClientApp/src/app/counter/counter.component.html
+++ /dev/null
@@ -1,7 +0,0 @@
-
Counter
-
-This is a simple example of an Angular component.
-
-Current count: {{ currentCount }}
-
-Increment
diff --git a/Single_Page_Anwendung/ClientApp/src/app/counter/counter.component.spec.ts b/Single_Page_Anwendung/ClientApp/src/app/counter/counter.component.spec.ts
deleted file mode 100644
index 026a91a..0000000
--- a/Single_Page_Anwendung/ClientApp/src/app/counter/counter.component.spec.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { CounterComponent } from './counter.component';
-
-describe('CounterComponent', () => {
- let component: CounterComponent;
- let fixture: ComponentFixture;
-
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- declarations: [ CounterComponent ]
- })
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(CounterComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it('should display a title', async(() => {
- const titleText = fixture.nativeElement.querySelector('h1').textContent;
- expect(titleText).toEqual('Counter');
- }));
-
- it('should start with count 0, then increments by 1 when clicked', async(() => {
- const countElement = fixture.nativeElement.querySelector('strong');
- expect(countElement.textContent).toEqual('0');
-
- const incrementButton = fixture.nativeElement.querySelector('button');
- incrementButton.click();
- fixture.detectChanges();
- expect(countElement.textContent).toEqual('1');
- }));
-});
diff --git a/Single_Page_Anwendung/ClientApp/src/app/counter/counter.component.ts b/Single_Page_Anwendung/ClientApp/src/app/counter/counter.component.ts
deleted file mode 100644
index 1f336aa..0000000
--- a/Single_Page_Anwendung/ClientApp/src/app/counter/counter.component.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { Component } from '@angular/core';
-
-@Component({
- selector: 'app-counter-component',
- templateUrl: './counter.component.html'
-})
-export class CounterComponent {
- public currentCount = 0;
-
- public incrementCounter() {
- this.currentCount++;
- }
-}
diff --git a/Single_Page_Anwendung/ClientApp/src/app/fetch-data/fetch-data.component.html b/Single_Page_Anwendung/ClientApp/src/app/fetch-data/fetch-data.component.html
deleted file mode 100644
index 19b3835..0000000
--- a/Single_Page_Anwendung/ClientApp/src/app/fetch-data/fetch-data.component.html
+++ /dev/null
@@ -1,24 +0,0 @@
-Weather forecast
-
-This component demonstrates fetching data from the server.
-
-Loading...
-
-
-
-
- Date
- Temp. (C)
- Temp. (F)
- Summary
-
-
-
-
- {{ forecast.date }}
- {{ forecast.temperatureC }}
- {{ forecast.temperatureF }}
- {{ forecast.summary }}
-
-
-
diff --git a/Single_Page_Anwendung/ClientApp/src/app/fetch-data/fetch-data.component.ts b/Single_Page_Anwendung/ClientApp/src/app/fetch-data/fetch-data.component.ts
deleted file mode 100644
index 9b81e1b..0000000
--- a/Single_Page_Anwendung/ClientApp/src/app/fetch-data/fetch-data.component.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { Component, Inject } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
-
-@Component({
- selector: 'app-fetch-data',
- templateUrl: './fetch-data.component.html'
-})
-export class FetchDataComponent {
- public forecasts: WeatherForecast[];
-
- constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string) {
- http.get(baseUrl + 'weatherforecast').subscribe(result => {
- this.forecasts = result;
- }, error => console.error(error));
- }
-}
-
-interface WeatherForecast {
- date: string;
- temperatureC: number;
- temperatureF: number;
- summary: string;
-}
diff --git a/Single_Page_Anwendung/ClientApp/src/app/home/home.component.html b/Single_Page_Anwendung/ClientApp/src/app/home/home.component.html
index f74c2e7..690fa54 100644
--- a/Single_Page_Anwendung/ClientApp/src/app/home/home.component.html
+++ b/Single_Page_Anwendung/ClientApp/src/app/home/home.component.html
@@ -1,14 +1 @@
-Hello, world!
-Welcome to your new single-page application, built with:
-
-To help you get started, we've also set up:
-
- Client-side navigation . For example, click Counter then Back to return here.
- Angular CLI integration . In development mode, there's no need to run ng serve
. It runs in the background automatically, so your client-side resources are dynamically built on demand and the page refreshes when you modify any file.
- Efficient production builds . In production mode, development-time features are disabled, and your dotnet publish
configuration automatically invokes ng build
to produce minified, ahead-of-time compiled JavaScript files.
-
-The ClientApp
subdirectory is a standard Angular CLI application. If you open a command prompt in that directory, you can run any ng
command (e.g., ng test
), or use npm
to install extra packages into it.
+DaRestaurante
\ No newline at end of file
diff --git a/Single_Page_Anwendung/ClientApp/src/app/nav-menu/nav-menu.component.css b/Single_Page_Anwendung/ClientApp/src/app/nav-menu/nav-menu.component.css
index 10389ef..e69de29 100644
--- a/Single_Page_Anwendung/ClientApp/src/app/nav-menu/nav-menu.component.css
+++ b/Single_Page_Anwendung/ClientApp/src/app/nav-menu/nav-menu.component.css
@@ -1,18 +0,0 @@
-a.navbar-brand {
- white-space: normal;
- text-align: center;
- word-break: break-all;
-}
-
-html {
- font-size: 14px;
-}
-@media (min-width: 768px) {
- html {
- font-size: 16px;
- }
-}
-
-.box-shadow {
- box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
-}
diff --git a/Single_Page_Anwendung/ClientApp/src/app/nav-menu/nav-menu.component.html b/Single_Page_Anwendung/ClientApp/src/app/nav-menu/nav-menu.component.html
index 6216ff2..79783df 100644
--- a/Single_Page_Anwendung/ClientApp/src/app/nav-menu/nav-menu.component.html
+++ b/Single_Page_Anwendung/ClientApp/src/app/nav-menu/nav-menu.component.html
@@ -1,44 +1 @@
-
+Menü
\ No newline at end of file
diff --git a/Single_Page_Anwendung/ClientApp/src/styles.css b/Single_Page_Anwendung/ClientApp/src/styles.css
index 3ef6a64..e69de29 100644
--- a/Single_Page_Anwendung/ClientApp/src/styles.css
+++ b/Single_Page_Anwendung/ClientApp/src/styles.css
@@ -1,16 +0,0 @@
-/* You can add global styles to this file, and also import other style files */
-
-/* Provide sufficient contrast against white background */
-a {
- color: #0366d6;
-}
-
-code {
- color: #e01a76;
-}
-
-.btn-primary {
- color: #fff;
- background-color: #1b6ec2;
- border-color: #1861ac;
-}
diff --git a/Single_Page_Anwendung/Migrations/20220607122417_InitialCreate.Designer.cs b/Single_Page_Anwendung/Migrations/20220610054518_InitialCreate.Designer.cs
similarity index 98%
rename from Single_Page_Anwendung/Migrations/20220607122417_InitialCreate.Designer.cs
rename to Single_Page_Anwendung/Migrations/20220610054518_InitialCreate.Designer.cs
index ea84dac..0bc2c40 100644
--- a/Single_Page_Anwendung/Migrations/20220607122417_InitialCreate.Designer.cs
+++ b/Single_Page_Anwendung/Migrations/20220610054518_InitialCreate.Designer.cs
@@ -9,7 +9,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Single_Page_Anwendung.Migrations
{
[DbContext(typeof(FutterContext))]
- [Migration("20220607122417_InitialCreate")]
+ [Migration("20220610054518_InitialCreate")]
partial class InitialCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
diff --git a/Single_Page_Anwendung/Migrations/20220607122417_InitialCreate.cs b/Single_Page_Anwendung/Migrations/20220610054518_InitialCreate.cs
similarity index 100%
rename from Single_Page_Anwendung/Migrations/20220607122417_InitialCreate.cs
rename to Single_Page_Anwendung/Migrations/20220610054518_InitialCreate.cs
diff --git a/Single_Page_Anwendung/Models/Speise.cs b/Single_Page_Anwendung/Models/Speise.cs
index cacd65c..fb69cd6 100644
--- a/Single_Page_Anwendung/Models/Speise.cs
+++ b/Single_Page_Anwendung/Models/Speise.cs
@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
+using System.Text.Json.Serialization;
namespace Aps_Single_Page_Anwendung.Models
{
@@ -17,6 +18,8 @@ namespace Aps_Single_Page_Anwendung.Models
public double Preis { get; set; }
public int KategorieId { get; set; }
+
+ [JsonIgnore]
public Kategorie Kategorie { get; set; }
}
}
diff --git a/Single_Page_Anwendung/Repositories/EfKategorieRepository.cs b/Single_Page_Anwendung/Repositories/EfKategorieRepository.cs
new file mode 100644
index 0000000..b9120a3
--- /dev/null
+++ b/Single_Page_Anwendung/Repositories/EfKategorieRepository.cs
@@ -0,0 +1,54 @@
+using Aps_Single_Page_Anwendung.Models;
+using Aps_Single_Page_Anwendung.Repositories;
+using Microsoft.EntityFrameworkCore;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Single_Page_Anwendung.Repositories
+{
+ public class EfKategorieRepository : IKategorieRepository
+ {
+ private readonly FutterContext _futterContext;
+
+ public EfKategorieRepository(FutterContext futterContext)
+ {
+ _futterContext = futterContext;
+ }
+ public Kategorie CreateKategorie(Kategorie kategorie)
+ {
+ _futterContext.Kategorien.Add(kategorie);
+ _futterContext.SaveChanges();
+ return kategorie;
+ }
+
+ public void DeleteKategorie(int id)
+ {
+ var kategorie = _futterContext.Kategorien.Find(id);
+ _futterContext.Kategorien.Remove(kategorie);
+ _futterContext.SaveChanges();
+
+ }
+
+ public Kategorie GetKategorieByID(int id)
+ {
+ var kategorie = _futterContext.Kategorien.Find(id);
+ return kategorie;
+ }
+
+ public IEnumerable GetKategorien()
+ {
+ var kategorie = _futterContext.Kategorien.AsNoTracking().Include(x => x.Speisen).ToList();
+ return kategorie;
+ }
+
+ public Kategorie UpdateKategorie(Kategorie kategorie)
+ {
+ var kategorieToUpdate = _futterContext.Kategorien.Find(kategorie.Id);
+ kategorieToUpdate.Name = kategorie.Name;
+ kategorieToUpdate.Beschreibung = kategorie.Beschreibung;
+ _futterContext.SaveChanges();
+ return kategorieToUpdate;
+
+ }
+ }
+}
diff --git a/Single_Page_Anwendung/Repositories/EfSpeisenRepository.cs b/Single_Page_Anwendung/Repositories/EfSpeisenRepository.cs
new file mode 100644
index 0000000..d98a7bf
--- /dev/null
+++ b/Single_Page_Anwendung/Repositories/EfSpeisenRepository.cs
@@ -0,0 +1,54 @@
+using Aps_Single_Page_Anwendung.Models;
+using Aps_Single_Page_Anwendung.Repositories;
+using Microsoft.EntityFrameworkCore;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Single_Page_Anwendung.Repositories
+{
+ public class EfSpeisenRepository : ISpeiseRepository
+ {
+ private readonly FutterContext _futterContext;
+
+ public EfSpeisenRepository(FutterContext futterContext)
+ {
+ _futterContext = futterContext;
+ }
+ public Speise CreateSpeise(Speise speise)
+ {
+ _futterContext.Speisen.Add(speise);
+ _futterContext.SaveChanges();
+ return speise;
+ }
+
+ public void DeleteSpeise(int id)
+ {
+ var speise = _futterContext.Speisen.Find(id);
+ _futterContext.Speisen.Remove(speise);
+ _futterContext.SaveChanges();
+ }
+
+ public Speise GetSpeiseById(int id)
+ {
+ var speise = _futterContext.Speisen.Find(id);
+ return speise;
+ }
+
+ public IEnumerable GetSpeisen()
+ {
+ var speisen = _futterContext.Speisen.AsNoTracking().ToList();
+ return speisen;
+ }
+
+ public Speise UpdateSpeise(Speise speise)
+ {
+ var speiseToUpdate = _futterContext.Speisen.Find(speise.Id);
+ speiseToUpdate.Name = speise.Name;
+ speiseToUpdate.Preis = speise.Preis;
+ speiseToUpdate.Beschreibung = speise.Beschreibung;
+ speiseToUpdate.KategorieId = speise.KategorieId;
+ _futterContext.SaveChanges();
+ return speise;
+ }
+ }
+}
diff --git a/Single_Page_Anwendung/Single_Page_Anwendung.csproj b/Single_Page_Anwendung/Single_Page_Anwendung.csproj
index aa03ca3..66e9629 100644
--- a/Single_Page_Anwendung/Single_Page_Anwendung.csproj
+++ b/Single_Page_Anwendung/Single_Page_Anwendung.csproj
@@ -29,6 +29,10 @@
+
+
+
+
diff --git a/Single_Page_Anwendung/Startup.cs b/Single_Page_Anwendung/Startup.cs
index eba8989..41c7fcd 100644
--- a/Single_Page_Anwendung/Startup.cs
+++ b/Single_Page_Anwendung/Startup.cs
@@ -8,6 +8,7 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
+using Single_Page_Anwendung.Repositories;
namespace Aps_Single_Page_Anwendung
{
@@ -29,8 +30,8 @@ namespace Aps_Single_Page_Anwendung
services.AddControllersWithViews();
// Sorgt dafür, das jedesmal wenn ein ISpeiseRep angefragt wird, wird ein FileSpeiseRep zurückgegeben
- services.AddScoped();
- services.AddScoped();
+ services.AddScoped();
+ services.AddScoped();
// In production, the Angular files will be served from this directory
diff --git a/Single_Page_Anwendung/WeatherForecast.cs b/Single_Page_Anwendung/WeatherForecast.cs
deleted file mode 100644
index 44bc102..0000000
--- a/Single_Page_Anwendung/WeatherForecast.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-
-namespace Aps_Single_Page_Anwendung
-{
- public class WeatherForecast
- {
- public DateTime Date { get; set; }
-
- public int TemperatureC { get; set; }
-
- public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
-
- public string Summary { get; set; }
- }
-}
diff --git a/Single_Page_Anwendung/data/kategorie.json b/Single_Page_Anwendung/data/kategorie.json
index 2371b6f..4171086 100644
--- a/Single_Page_Anwendung/data/kategorie.json
+++ b/Single_Page_Anwendung/data/kategorie.json
@@ -1,31 +1,31 @@
[{
- "id": 1,
- "name": "Salate",
- "beschreibung": "Fröhlich bunte Salate"
+ "Id": 1,
+ "Name": "Salate",
+ "Beschreibung": "Fröhlich bunte Salate"
},
{
- "id": 2,
- "name": "Suppen",
- "beschreibung": "Cremige Suppen"
+ "Id": 2,
+ "Name": "Suppen",
+ "Beschreibung": "Cremige Suppen"
},
{
- "id": 3,
- "name": "Vorspeißen",
- "beschreibung": "Kleine Portionen"
+ "Id": 3,
+ "Name": "Vorspeißen",
+ "Beschreibung": "Kleine Portionen"
},
{
- "id": 4,
- "name": "Hauptgerichte",
- "beschreibung": "Eine vielfalt aus verschiedenen Gerichten"
+ "Id": 4,
+ "Name": "Hauptgerichte",
+ "Beschreibung": "Eine vielfalt aus verschiedenen Gerichten"
},
{
- "id": 5,
- "name": "Nachspeißen",
- "beschreibung": "Leckere süße Desserts"
+ "Id": 5,
+ "Name": "Nachspeißen",
+ "Beschreibung": "Leckere süße Desserts"
},
{
- "id": 6,
- "name": "Getränke",
- "beschreibung": "Eine große Auswahl an Getränkeetränken"
+ "Id": 6,
+ "Name": "Getränke",
+ "Beschreibung": "Eine große Auswahl an Getränkeetränken"
}
]
\ No newline at end of file