Merge branch 'feature/EditingDatabase' into develop

This commit is contained in:
2025-10-10 10:37:37 +02:00
4 changed files with 2007 additions and 7 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,52 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PyroFetes.Migrations
{
/// <inheritdoc />
public partial class FixingDatabase : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "References",
table: "Products");
migrationBuilder.DropColumn(
name: "SellingPrice",
table: "Products");
migrationBuilder.AddColumn<string>(
name: "Reference",
table: "Products",
type: "nvarchar(20)",
maxLength: 20,
nullable: false,
defaultValue: "");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Reference",
table: "Products");
migrationBuilder.AddColumn<int>(
name: "References",
table: "Products",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<decimal>(
name: "SellingPrice",
table: "Products",
type: "decimal(18,2)",
nullable: false,
defaultValue: 0m);
}
}
}

View File

@@ -541,11 +541,10 @@ namespace PyroFetes.Migrations
b.Property<int>("ProductCategoryId")
.HasColumnType("int");
b.Property<int>("References")
.HasColumnType("int");
b.Property<decimal>("SellingPrice")
.HasColumnType("decimal(18,2)");
b.Property<string>("Reference")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<decimal>("Weight")
.HasColumnType("decimal(18,2)");

View File

@@ -5,14 +5,13 @@ namespace PyroFetes.Models
public class Product
{
[Key] public int Id { get; set; }
[Required] public int References { get; set; }
[Required, MaxLength(20)] public string? Reference { get; set; }
[Required, MaxLength(100)] public string? Name { get; set; }
[Required] public decimal Duration {get; set;}
[Required] public decimal Caliber { get; set; }
[Required] public int ApprovalNumber { get; set; }
[Required] public decimal Weight { get; set; }
[Required] public decimal Nec { get; set; }
[Required] public decimal SellingPrice { get; set; }
[Required] public string? Image { get; set; }
[Required, MaxLength(200)] public string? Link { get; set; }
[Required] public int MinimalQuantity { get; set; }