Neuste News
This commit is contained in:
parent
0bf240ccda
commit
d5fe1fc04c
97
FilterCair.Server/Controllers/CustomerController.cs
Normal file
97
FilterCair.Server/Controllers/CustomerController.cs
Normal file
@ -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<ActionResult<IEnumerable<CustomerModel>>> GetCustomers()
|
||||
{
|
||||
return await _context.Customers.ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
//Load single Customer
|
||||
[HttpGet("{id}")]
|
||||
public async Task<ActionResult<CustomerModel>> GetCustomer(int id)
|
||||
{
|
||||
var customer = await _context.Customers.FindAsync(id);
|
||||
if (customer == null)
|
||||
return NotFound();
|
||||
|
||||
return customer;
|
||||
}
|
||||
|
||||
//Create Customer
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<CustomerModel>> 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<IActionResult> 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<IActionResult> 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
70
FilterCair.Server/Controllers/FilterController.cs
Normal file
70
FilterCair.Server/Controllers/FilterController.cs
Normal file
@ -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<ActionResult<IEnumerable<FilterModel>>> GetFiltersByStation(int stationId)
|
||||
{
|
||||
return await _context.Filters
|
||||
.Where(f => f.StationId == stationId).ToListAsync();
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> CreateFilter(FilterModel filter)
|
||||
{
|
||||
_context.Filters.Add(filter);
|
||||
await _context.SaveChangesAsync();
|
||||
return CreatedAtAction(nameof(GetFiltersByStation), new { stationId = filter.StationId }, filter);
|
||||
}
|
||||
|
||||
[HttpGet("{id}")]
|
||||
public async Task<ActionResult<FilterModel>> GetFilterById(int id)
|
||||
{
|
||||
var filter = await _context.Filters.FindAsync(id);
|
||||
if (filter == null)
|
||||
return NotFound();
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
[HttpPut("{id}")]
|
||||
public async Task<IActionResult> 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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
35
FilterCair.Server/Controllers/StationController.cs
Normal file
35
FilterCair.Server/Controllers/StationController.cs
Normal file
@ -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<ActionResult<IEnumerable<StationModel>>> GetStationsByCustomer(int customerId)
|
||||
{
|
||||
return await _context.Stations
|
||||
.Where(s => s.CustomerId == customerId).ToListAsync();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> CreateStation(StationModel station)
|
||||
{
|
||||
_context.Stations.Add(station);
|
||||
await _context.SaveChangesAsync();
|
||||
return CreatedAtAction(nameof(GetStationsByCustomer), new { customerId = station.CustomerId }, station);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
21
FilterCair.Server/Data/FilterCairContext.cs
Normal file
21
FilterCair.Server/Data/FilterCairContext.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using FilterCair.Shared.Models;
|
||||
|
||||
|
||||
namespace FilterCair.Server.Data
|
||||
{
|
||||
public class FilterCairContext : DbContext
|
||||
{
|
||||
public FilterCairContext(DbContextOptions<FilterCairContext> options)
|
||||
: base(options)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public DbSet<CustomerModel> Customers => Set<CustomerModel>();
|
||||
public DbSet<FilterModel> Filters => Set<FilterModel>();
|
||||
public DbSet<StationModel> Stations => Set<StationModel>();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
23
FilterCair.Server/Data/FilterCairContextFactory.cs
Normal file
23
FilterCair.Server/Data/FilterCairContextFactory.cs
Normal file
@ -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<FilterCairContext>
|
||||
{
|
||||
public FilterCairContext CreateDbContext(string[] args)
|
||||
{
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile("appsettings.json")
|
||||
.Build();
|
||||
|
||||
var optionsBuilder = new DbContextOptionsBuilder<FilterCairContext>();
|
||||
optionsBuilder.UseSqlServer(configuration.GetConnectionString("DefaultConnection"));
|
||||
|
||||
return new FilterCairContext(optionsBuilder.Options);
|
||||
}
|
||||
}
|
||||
}
|
||||
62
FilterCair.Server/Migrations/20251105122335_InitCustomers.Designer.cs
generated
Normal file
62
FilterCair.Server/Migrations/20251105122335_InitCustomers.Designer.cs
generated
Normal file
@ -0,0 +1,62 @@
|
||||
// <auto-generated />
|
||||
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
|
||||
{
|
||||
/// <inheritdoc />
|
||||
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<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Ansprechpartner")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Standort")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Telefon")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Customers");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
38
FilterCair.Server/Migrations/20251105122335_InitCustomers.cs
Normal file
38
FilterCair.Server/Migrations/20251105122335_InitCustomers.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FilterCair.Server.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitCustomers : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Customers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Standort = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Ansprechpartner = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Telefon = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Customers", x => x.Id);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Customers");
|
||||
}
|
||||
}
|
||||
}
|
||||
133
FilterCair.Server/Migrations/20251105144410_AddStationsAndFilters.Designer.cs
generated
Normal file
133
FilterCair.Server/Migrations/20251105144410_AddStationsAndFilters.Designer.cs
generated
Normal file
@ -0,0 +1,133 @@
|
||||
// <auto-generated />
|
||||
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
|
||||
{
|
||||
/// <inheritdoc />
|
||||
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<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Ansprechpartner")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Standort")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Telefon")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Customers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterCair.Shared.Models.FilterModel", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Bezeichnung")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime?>("Einbaudatum")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("LetzteWartung")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("QRCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Seriennummer")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Typ")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Zustand")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Filters");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterCair.Shared.Models.StationModel", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Beschreibung")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("CustomerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Standort")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Stations");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FilterCair.Server.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddStationsAndFilters : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Filters",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
StationId = table.Column<int>(type: "int", nullable: false),
|
||||
Bezeichnung = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Typ = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Seriennummer = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Einbaudatum = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
LetzteWartung = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
Zustand = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
QRCode = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Filters", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Stations",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
CustomerId = table.Column<int>(type: "int", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Standort = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Beschreibung = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Stations", x => x.Id);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Filters");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Stations");
|
||||
}
|
||||
}
|
||||
}
|
||||
133
FilterCair.Server/Migrations/20251105144730_AddStationsAndFilters2.Designer.cs
generated
Normal file
133
FilterCair.Server/Migrations/20251105144730_AddStationsAndFilters2.Designer.cs
generated
Normal file
@ -0,0 +1,133 @@
|
||||
// <auto-generated />
|
||||
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
|
||||
{
|
||||
/// <inheritdoc />
|
||||
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<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Ansprechpartner")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Standort")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Telefon")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Customers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterCair.Shared.Models.FilterModel", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Bezeichnung")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime?>("Einbaudatum")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("LetzteWartung")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("QRCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Seriennummer")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Typ")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Zustand")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Filters");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterCair.Shared.Models.StationModel", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Beschreibung")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("CustomerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Standort")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Stations");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FilterCair.Server.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddStationsAndFilters2 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
130
FilterCair.Server/Migrations/FilterCairContextModelSnapshot.cs
Normal file
130
FilterCair.Server/Migrations/FilterCairContextModelSnapshot.cs
Normal file
@ -0,0 +1,130 @@
|
||||
// <auto-generated />
|
||||
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<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Ansprechpartner")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Standort")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Telefon")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Customers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterCair.Shared.Models.FilterModel", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Bezeichnung")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime?>("Einbaudatum")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("LetzteWartung")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("QRCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Seriennummer")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Typ")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Zustand")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Filters");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterCair.Shared.Models.StationModel", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Beschreibung")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("CustomerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Standort")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Stations");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
FilterCair.Server/OnProf_Deploy.zip
Normal file
BIN
FilterCair.Server/OnProf_Deploy.zip
Normal file
Binary file not shown.
@ -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')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
17
FilterCair.Shared/Models/StationModel.cs
Normal file
17
FilterCair.Shared/Models/StationModel.cs
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user