diff --git a/FilterCair.Server/Controllers/CustomerController.cs b/FilterCair.Server/Controllers/CustomerController.cs new file mode 100644 index 0000000..c8557f0 --- /dev/null +++ b/FilterCair.Server/Controllers/CustomerController.cs @@ -0,0 +1,97 @@ +using FilterCair.Server.Data; +using FilterCair.Shared.Models; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; + +namespace FilterCair.Server.Controllers +{ + [Route("api/[controller]")] + [ApiController] + //[Authorize] // + public class CustomerController : ControllerBase + { + private readonly FilterCairContext _context; + + public CustomerController(FilterCairContext context) + { + _context = context; + } + + //Load all Customers + [HttpGet] + public async Task>> GetCustomers() + { + return await _context.Customers.ToListAsync(); + } + + + //Load single Customer + [HttpGet("{id}")] + public async Task> GetCustomer(int id) + { + var customer = await _context.Customers.FindAsync(id); + if (customer == null) + return NotFound(); + + return customer; + } + + //Create Customer + [HttpPost] + public async Task> PostCustomer(CustomerModel customer) + { + _context.Customers.Add(customer); + await _context.SaveChangesAsync(); + return CreatedAtAction(nameof(GetCustomer), new { id = customer.Id }, customer); + } + + + //Delete Customer + [HttpDelete("{id}")] + public async Task DeleteCustomer(int id) + { + var customer = await _context.Customers.FindAsync(id); + if (customer == null) + return NotFound(); + + _context.Customers.Remove(customer); + await _context.SaveChangesAsync(); + return NoContent(); + } + + //PUT Customer + [HttpPut("{id}")] + public async Task PutCustomer(int id, CustomerModel customer) + { + if (id != customer.Id) + return BadRequest(); + + var existing = await _context.Customers.FindAsync(id); + if (existing == null) + return NotFound(); + + existing.Name = customer.Name; + existing.Standort = customer.Standort; + existing.Ansprechpartner = customer.Ansprechpartner; + existing.Email = customer.Email; + existing.Telefon = customer.Telefon; + + _context.Entry(existing).State = EntityState.Modified; + + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateConcurrencyException) + { + if (!_context.Customers.Any(c => c.Id == id)) + return NotFound(); + else + throw; + } + + return NoContent(); + } + } +} diff --git a/FilterCair.Server/Controllers/FilterController.cs b/FilterCair.Server/Controllers/FilterController.cs new file mode 100644 index 0000000..d15af56 --- /dev/null +++ b/FilterCair.Server/Controllers/FilterController.cs @@ -0,0 +1,70 @@ +using FilterCair.Server.Data; +using FilterCair.Shared.Models; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; + +namespace FilterCair.Server.Controllers +{ + [ApiController] + [Route("api/[controller]")] + public class FilterController : ControllerBase + { + private readonly FilterCairContext _context; + + public FilterController(FilterCairContext context) + { + _context = context; + } + + [HttpGet("byStation/{stationId}")] + public async Task>> GetFiltersByStation(int stationId) + { + return await _context.Filters + .Where(f => f.StationId == stationId).ToListAsync(); + + } + + [HttpPost] + public async Task CreateFilter(FilterModel filter) + { + _context.Filters.Add(filter); + await _context.SaveChangesAsync(); + return CreatedAtAction(nameof(GetFiltersByStation), new { stationId = filter.StationId }, filter); + } + + [HttpGet("{id}")] + public async Task> GetFilterById(int id) + { + var filter = await _context.Filters.FindAsync(id); + if (filter == null) + return NotFound(); + + return filter; + } + + [HttpPut("{id}")] + public async Task UpdateFilter(int id, FilterModel updatedFilter) + { + if (id != updatedFilter.Id) + return BadRequest("ID stimmt nicht überein."); + + var existing = await _context.Filters.FindAsync(id); + if (existing == null) + return NotFound(); + + // Werte übernehmen + existing.Bezeichnung = updatedFilter.Bezeichnung; + existing.Typ = updatedFilter.Typ; + existing.Seriennummer = updatedFilter.Seriennummer; + existing.Einbaudatum = updatedFilter.Einbaudatum; + existing.LetzteWartung = updatedFilter.LetzteWartung; + existing.Zustand = updatedFilter.Zustand; + existing.QRCode = updatedFilter.QRCode; + + await _context.SaveChangesAsync(); + return NoContent(); + } + + } + +} diff --git a/FilterCair.Server/Controllers/StationController.cs b/FilterCair.Server/Controllers/StationController.cs new file mode 100644 index 0000000..5a08f9c --- /dev/null +++ b/FilterCair.Server/Controllers/StationController.cs @@ -0,0 +1,35 @@ +using FilterCair.Server.Data; +using FilterCair.Shared.Models; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; + +namespace FilterCair.Server.Controllers +{ + [ApiController] + [Route("api/[controller]")] + public class StationController : ControllerBase + { + private readonly FilterCairContext _context; + + public StationController(FilterCairContext context) + { + _context = context; + } + + [HttpGet("byCustomer/{customerId}")] + public async Task>> GetStationsByCustomer(int customerId) + { + return await _context.Stations + .Where(s => s.CustomerId == customerId).ToListAsync(); + } + + [HttpPost] + public async Task CreateStation(StationModel station) + { + _context.Stations.Add(station); + await _context.SaveChangesAsync(); + return CreatedAtAction(nameof(GetStationsByCustomer), new { customerId = station.CustomerId }, station); + } + } + +} diff --git a/FilterCair.Server/Data/FilterCairContext.cs b/FilterCair.Server/Data/FilterCairContext.cs new file mode 100644 index 0000000..cd0e792 --- /dev/null +++ b/FilterCair.Server/Data/FilterCairContext.cs @@ -0,0 +1,21 @@ +using Microsoft.EntityFrameworkCore; +using FilterCair.Shared.Models; + + +namespace FilterCair.Server.Data +{ + public class FilterCairContext : DbContext + { + public FilterCairContext(DbContextOptions options) + : base(options) + { + + } + + public DbSet Customers => Set(); + public DbSet Filters => Set(); + public DbSet Stations => Set(); + + + } +} diff --git a/FilterCair.Server/Data/FilterCairContextFactory.cs b/FilterCair.Server/Data/FilterCairContextFactory.cs new file mode 100644 index 0000000..3c9f263 --- /dev/null +++ b/FilterCair.Server/Data/FilterCairContextFactory.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Design; +using Microsoft.Extensions.Configuration; +using System.IO; + +namespace FilterCair.Server.Data +{ + public class FilterCairContextFactory : IDesignTimeDbContextFactory + { + public FilterCairContext CreateDbContext(string[] args) + { + var configuration = new ConfigurationBuilder() + .SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("appsettings.json") + .Build(); + + var optionsBuilder = new DbContextOptionsBuilder(); + optionsBuilder.UseSqlServer(configuration.GetConnectionString("DefaultConnection")); + + return new FilterCairContext(optionsBuilder.Options); + } + } +} diff --git a/FilterCair.Server/Migrations/20251105122335_InitCustomers.Designer.cs b/FilterCair.Server/Migrations/20251105122335_InitCustomers.Designer.cs new file mode 100644 index 0000000..1bd41da --- /dev/null +++ b/FilterCair.Server/Migrations/20251105122335_InitCustomers.Designer.cs @@ -0,0 +1,62 @@ +// +using FilterCair.Server.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FilterCair.Server.Migrations +{ + [DbContext(typeof(FilterCairContext))] + [Migration("20251105122335_InitCustomers")] + partial class InitCustomers + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FilterCair.Shared.Models.CustomerModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Ansprechpartner") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Standort") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Telefon") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Customers"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FilterCair.Server/Migrations/20251105122335_InitCustomers.cs b/FilterCair.Server/Migrations/20251105122335_InitCustomers.cs new file mode 100644 index 0000000..5b277f3 --- /dev/null +++ b/FilterCair.Server/Migrations/20251105122335_InitCustomers.cs @@ -0,0 +1,38 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FilterCair.Server.Migrations +{ + /// + public partial class InitCustomers : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Customers", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(max)", nullable: false), + Standort = table.Column(type: "nvarchar(max)", nullable: false), + Ansprechpartner = table.Column(type: "nvarchar(max)", nullable: false), + Email = table.Column(type: "nvarchar(max)", nullable: false), + Telefon = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Customers", x => x.Id); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Customers"); + } + } +} diff --git a/FilterCair.Server/Migrations/20251105144410_AddStationsAndFilters.Designer.cs b/FilterCair.Server/Migrations/20251105144410_AddStationsAndFilters.Designer.cs new file mode 100644 index 0000000..58b44c0 --- /dev/null +++ b/FilterCair.Server/Migrations/20251105144410_AddStationsAndFilters.Designer.cs @@ -0,0 +1,133 @@ +// +using System; +using FilterCair.Server.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FilterCair.Server.Migrations +{ + [DbContext(typeof(FilterCairContext))] + [Migration("20251105144410_AddStationsAndFilters")] + partial class AddStationsAndFilters + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FilterCair.Shared.Models.CustomerModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Ansprechpartner") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Standort") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Telefon") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Customers"); + }); + + modelBuilder.Entity("FilterCair.Shared.Models.FilterModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Bezeichnung") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Einbaudatum") + .HasColumnType("datetime2"); + + b.Property("LetzteWartung") + .HasColumnType("datetime2"); + + b.Property("QRCode") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Seriennummer") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StationId") + .HasColumnType("int"); + + b.Property("Typ") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Zustand") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Filters"); + }); + + modelBuilder.Entity("FilterCair.Shared.Models.StationModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Beschreibung") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CustomerId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Standort") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Stations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FilterCair.Server/Migrations/20251105144410_AddStationsAndFilters.cs b/FilterCair.Server/Migrations/20251105144410_AddStationsAndFilters.cs new file mode 100644 index 0000000..da28bb4 --- /dev/null +++ b/FilterCair.Server/Migrations/20251105144410_AddStationsAndFilters.cs @@ -0,0 +1,61 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FilterCair.Server.Migrations +{ + /// + public partial class AddStationsAndFilters : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Filters", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + StationId = table.Column(type: "int", nullable: false), + Bezeichnung = table.Column(type: "nvarchar(max)", nullable: false), + Typ = table.Column(type: "nvarchar(max)", nullable: false), + Seriennummer = table.Column(type: "nvarchar(max)", nullable: false), + Einbaudatum = table.Column(type: "datetime2", nullable: true), + LetzteWartung = table.Column(type: "datetime2", nullable: true), + Zustand = table.Column(type: "nvarchar(max)", nullable: false), + QRCode = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Filters", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Stations", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CustomerId = table.Column(type: "int", nullable: false), + Name = table.Column(type: "nvarchar(max)", nullable: false), + Standort = table.Column(type: "nvarchar(max)", nullable: false), + Beschreibung = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Stations", x => x.Id); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Filters"); + + migrationBuilder.DropTable( + name: "Stations"); + } + } +} diff --git a/FilterCair.Server/Migrations/20251105144730_AddStationsAndFilters2.Designer.cs b/FilterCair.Server/Migrations/20251105144730_AddStationsAndFilters2.Designer.cs new file mode 100644 index 0000000..29a385f --- /dev/null +++ b/FilterCair.Server/Migrations/20251105144730_AddStationsAndFilters2.Designer.cs @@ -0,0 +1,133 @@ +// +using System; +using FilterCair.Server.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FilterCair.Server.Migrations +{ + [DbContext(typeof(FilterCairContext))] + [Migration("20251105144730_AddStationsAndFilters2")] + partial class AddStationsAndFilters2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FilterCair.Shared.Models.CustomerModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Ansprechpartner") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Standort") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Telefon") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Customers"); + }); + + modelBuilder.Entity("FilterCair.Shared.Models.FilterModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Bezeichnung") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Einbaudatum") + .HasColumnType("datetime2"); + + b.Property("LetzteWartung") + .HasColumnType("datetime2"); + + b.Property("QRCode") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Seriennummer") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StationId") + .HasColumnType("int"); + + b.Property("Typ") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Zustand") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Filters"); + }); + + modelBuilder.Entity("FilterCair.Shared.Models.StationModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Beschreibung") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CustomerId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Standort") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Stations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FilterCair.Server/Migrations/20251105144730_AddStationsAndFilters2.cs b/FilterCair.Server/Migrations/20251105144730_AddStationsAndFilters2.cs new file mode 100644 index 0000000..76970d9 --- /dev/null +++ b/FilterCair.Server/Migrations/20251105144730_AddStationsAndFilters2.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FilterCair.Server.Migrations +{ + /// + public partial class AddStationsAndFilters2 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/FilterCair.Server/Migrations/FilterCairContextModelSnapshot.cs b/FilterCair.Server/Migrations/FilterCairContextModelSnapshot.cs new file mode 100644 index 0000000..0777c8b --- /dev/null +++ b/FilterCair.Server/Migrations/FilterCairContextModelSnapshot.cs @@ -0,0 +1,130 @@ +// +using System; +using FilterCair.Server.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FilterCair.Server.Migrations +{ + [DbContext(typeof(FilterCairContext))] + partial class FilterCairContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FilterCair.Shared.Models.CustomerModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Ansprechpartner") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Standort") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Telefon") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Customers"); + }); + + modelBuilder.Entity("FilterCair.Shared.Models.FilterModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Bezeichnung") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Einbaudatum") + .HasColumnType("datetime2"); + + b.Property("LetzteWartung") + .HasColumnType("datetime2"); + + b.Property("QRCode") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Seriennummer") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StationId") + .HasColumnType("int"); + + b.Property("Typ") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Zustand") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Filters"); + }); + + modelBuilder.Entity("FilterCair.Shared.Models.StationModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Beschreibung") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CustomerId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Standort") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Stations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FilterCair.Server/OnProf_Deploy.zip b/FilterCair.Server/OnProf_Deploy.zip new file mode 100644 index 0000000..e9504f4 Binary files /dev/null and b/FilterCair.Server/OnProf_Deploy.zip differ diff --git a/FilterCair.Server/Properties/ServiceDependencies/FilterCair-Server - Web Deploy/profile.arm.json b/FilterCair.Server/Properties/ServiceDependencies/FilterCair-Server - Web Deploy/profile.arm.json new file mode 100644 index 0000000..68f0882 --- /dev/null +++ b/FilterCair.Server/Properties/ServiceDependencies/FilterCair-Server - Web Deploy/profile.arm.json @@ -0,0 +1,113 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "_dependencyType": "compute.appService.windows" + }, + "parameters": { + "resourceGroupName": { + "type": "string", + "defaultValue": "FilterCair-RG", + "metadata": { + "description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking." + } + }, + "resourceGroupLocation": { + "type": "string", + "defaultValue": "westeurope", + "metadata": { + "description": "Location of the resource group. Resource groups could have different location than resources, however by default we use API versions from latest hybrid profile which support all locations for resource types we support." + } + }, + "resourceName": { + "type": "string", + "defaultValue": "FilterCair-Server", + "metadata": { + "description": "Name of the main resource to be created by this template." + } + }, + "resourceLocation": { + "type": "string", + "defaultValue": "[parameters('resourceGroupLocation')]", + "metadata": { + "description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there." + } + } + }, + "variables": { + "appServicePlan_name": "[concat('Plan', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]", + "appServicePlan_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/serverFarms/', variables('appServicePlan_name'))]" + }, + "resources": [ + { + "type": "Microsoft.Resources/resourceGroups", + "name": "[parameters('resourceGroupName')]", + "location": "[parameters('resourceGroupLocation')]", + "apiVersion": "2019-10-01" + }, + { + "type": "Microsoft.Resources/deployments", + "name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]", + "resourceGroup": "[parameters('resourceGroupName')]", + "apiVersion": "2019-10-01", + "dependsOn": [ + "[parameters('resourceGroupName')]" + ], + "properties": { + "mode": "Incremental", + "template": { + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [ + { + "location": "[parameters('resourceLocation')]", + "name": "[parameters('resourceName')]", + "type": "Microsoft.Web/sites", + "apiVersion": "2015-08-01", + "tags": { + "[concat('hidden-related:', variables('appServicePlan_ResourceId'))]": "empty" + }, + "dependsOn": [ + "[variables('appServicePlan_ResourceId')]" + ], + "kind": "app", + "properties": { + "name": "[parameters('resourceName')]", + "kind": "app", + "httpsOnly": true, + "reserved": false, + "serverFarmId": "[variables('appServicePlan_ResourceId')]", + "siteConfig": { + "metadata": [ + { + "name": "CURRENT_STACK", + "value": "dotnet" + } + ] + } + }, + "identity": { + "type": "SystemAssigned" + } + }, + { + "location": "[parameters('resourceLocation')]", + "name": "[variables('appServicePlan_name')]", + "type": "Microsoft.Web/serverFarms", + "apiVersion": "2015-08-01", + "sku": { + "name": "S1", + "tier": "Standard", + "family": "S", + "size": "S1" + }, + "properties": { + "name": "[variables('appServicePlan_name')]" + } + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/FilterCair.Shared/Models/StationModel.cs b/FilterCair.Shared/Models/StationModel.cs new file mode 100644 index 0000000..2fe65d5 --- /dev/null +++ b/FilterCair.Shared/Models/StationModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FilterCair.Shared.Models +{ + public class StationModel + { + public int Id { get; set; } + public int CustomerId { get; set; } + public string Name { get; set; } = string.Empty; + public string Standort { get; set; } = string.Empty; + public string Beschreibung { get; set; } = string.Empty; + } +} \ No newline at end of file