diff --git a/Controllers/API/Inventory/InvMainAPI.cs b/Controllers/API/Inventory/InvMainAPI.cs
index e925361..6b4bf8b 100644
--- a/Controllers/API/Inventory/InvMainAPI.cs
+++ b/Controllers/API/Inventory/InvMainAPI.cs
@@ -268,41 +268,60 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
try
{
- var companyDepartment = await GetDepartmentWithCompany(item.CompanyId, item.DepartmentId);
- var itemProduct = _authDbContext.Products.Where(p => p.ProductId == item.ProductId).FirstOrDefault();
- string? companyInitial = companyDepartment?.CompanyName?.ToString().Substring(0, 1).ToUpper();
- string? depatmentInitial = companyDepartment?.DepartmentName?.ToString().Substring(0, 1).ToUpper();
- char? initialCategory = itemProduct?.Category.ToString().Substring(0, 1).ToUpper().FirstOrDefault();
- string? productId = itemProduct?.ProductId.ToString("D3");
- string? itemId = item?.ItemID+1.ToString("D5");
- var uniqueId = companyInitial+depatmentInitial+initialCategory+productId+itemId?.ToUpper();
- _authDbContext.Items.Add(item);
- await _authDbContext.SaveChangesAsync();
- var updatedItem = await _authDbContext.Items.Select(i => new
- {
- i.ItemID,
- i.UniqueID,
- i.CompanyId,
- i.DepartmentId,
- i.ProductId,
- i.SerialNumber,
- i.Quantity,
- i.Supplier,
- i.PurchaseDate,
- i.PONo,
- i.Currency,
- i.PriceInRM,
- i.CurrencyRate,
- i.ConvertPrice,
- i.DODate,
- i.Warranty,
- i.EndWDate,
- i.InvoiceDate,
- }).FirstOrDefaultAsync(i => i.ItemID == item.ItemID);
+ var product = await _authDbContext.Products.FirstOrDefaultAsync(p => p.ProductId == item.ProductId) ?? throw new Exception("Product not found");
+
+ var addToProduct = item.Quantity;
+ product.QuantityProduct += addToProduct;
+
+ if (product.Category == "Disposable")
+ {
+ item.SerialNumber = null;
+ }
- updatedItem.UniqueID = uniqueId;
_authDbContext.Items.Add(item);
- await _authDbContext.SaveChangesAsync();
+ _authDbContext.Products.Update(product);
+ await _authDbContext.SaveChangesAsync(); // This generates the auto-incremented ItemID
+
+ // Fetch the generated ItemID
+ var savedItem = await _authDbContext.Items.FirstOrDefaultAsync(i => i.ItemID == item.ItemID);
+
+ if (savedItem != null)
+ {
+ var companyDepartment = await GetDepartmentWithCompany(item.CompanyId, item.DepartmentId);
+ var itemProduct = _authDbContext.Products.Where(p => p.ProductId == item.ProductId).FirstOrDefault();
+
+ string? companyInitial = companyDepartment!.CompanyName?.ToString().Substring(0, 1).ToUpper();
+ string? departmentInitial = companyDepartment!.DepartmentName?.ToString().Substring(0, 1).ToUpper();
+ char? initialCategory = itemProduct!.Category.ToString().Substring(0, 1).ToUpper().FirstOrDefault();
+ string? productId = itemProduct!.ProductId.ToString("D3");
+ string? itemId = item.ItemID.ToString("D5");
+ var uniqueId = $"{companyInitial}{departmentInitial}{initialCategory}{productId}{itemId}".ToUpper();
+ savedItem.UniqueID = uniqueId;
+
+ _authDbContext.Items.Update(savedItem);
+ await _authDbContext.SaveChangesAsync();
+ }
+ var updatedItem = new
+ {
+ savedItem!.ItemID,
+ savedItem.UniqueID,
+ savedItem.CompanyId,
+ savedItem.DepartmentId,
+ savedItem.ProductId,
+ savedItem.SerialNumber,
+ savedItem.Quantity,
+ savedItem.Supplier,
+ savedItem.PurchaseDate,
+ savedItem.PONo,
+ savedItem.Currency,
+ savedItem.PriceInRM,
+ savedItem.CurrencyRate,
+ savedItem.ConvertPrice,
+ savedItem.DODate,
+ savedItem.Warranty,
+ savedItem.EndWDate,
+ savedItem.InvoiceDate,
+ };
return Json(updatedItem);
}
catch (Exception ex)
diff --git a/Migrations/20241129023507_UpdateItemModel.Designer.cs b/Migrations/20241129023507_UpdateItemModel.Designer.cs
new file mode 100644
index 0000000..b0af4f9
--- /dev/null
+++ b/Migrations/20241129023507_UpdateItemModel.Designer.cs
@@ -0,0 +1,647 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using PSTW_CentralSystem.DBContext;
+
+#nullable disable
+
+namespace PSTW_CentralSystem.Migrations
+{
+ [DbContext(typeof(AuthDBContext))]
+ [Migration("20241129023507_UpdateItemModel")]
+ partial class UpdateItemModel
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.11")
+ .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+ MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim
", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("ClaimType")
+ .HasColumnType("longtext");
+
+ b.Property("ClaimValue")
+ .HasColumnType("longtext");
+
+ b.Property("RoleId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("ClaimType")
+ .HasColumnType("longtext");
+
+ b.Property("ClaimValue")
+ .HasColumnType("longtext");
+
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
+ {
+ b.Property("LoginProvider")
+ .HasColumnType("varchar(255)");
+
+ b.Property("ProviderKey")
+ .HasColumnType("varchar(255)");
+
+ b.Property("ProviderDisplayName")
+ .HasColumnType("longtext");
+
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.Property("RoleId")
+ .HasColumnType("int");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles", (string)null);
+
+ b.HasData(
+ new
+ {
+ UserId = 1,
+ RoleId = 1
+ });
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.Property("LoginProvider")
+ .HasColumnType("varchar(255)");
+
+ b.Property("Name")
+ .HasColumnType("varchar(255)");
+
+ b.Property("Value")
+ .HasColumnType("longtext");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens", (string)null);
+ });
+
+ modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b =>
+ {
+ b.Property("CompanyId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CompanyId"));
+
+ b.Property("CompanyName")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("CompanyId");
+
+ b.ToTable("Companies");
+ });
+
+ modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b =>
+ {
+ b.Property("DepartmentId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DepartmentId"));
+
+ b.Property("CompanyId")
+ .HasColumnType("int");
+
+ b.Property("DepartmentName")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("DepartmentId");
+
+ b.HasIndex("CompanyId");
+
+ b.ToTable("Departments");
+ });
+
+ modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
+ {
+ b.Property("ItemID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ItemID"));
+
+ b.Property("CompanyId")
+ .HasColumnType("int");
+
+ b.Property("ConvertPrice")
+ .HasColumnType("float");
+
+ b.Property("Currency")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("CurrencyRate")
+ .HasColumnType("float");
+
+ b.Property("DODate")
+ .HasColumnType("datetime(6)");
+
+ b.Property("DepartmentId")
+ .HasColumnType("int");
+
+ b.Property("EndWDate")
+ .HasColumnType("datetime(6)");
+
+ b.Property("InvoiceDate")
+ .HasColumnType("datetime(6)");
+
+ b.Property("PONo")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("PriceInRM")
+ .HasColumnType("float");
+
+ b.Property("ProductId")
+ .HasColumnType("int");
+
+ b.Property("PurchaseDate")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Quantity")
+ .HasColumnType("int");
+
+ b.Property("SerialNumber")
+ .HasColumnType("longtext");
+
+ b.Property("Supplier")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("UniqueID")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Warranty")
+ .HasColumnType("int");
+
+ b.HasKey("ItemID");
+
+ b.HasIndex("CompanyId");
+
+ b.HasIndex("DepartmentId");
+
+ b.HasIndex("ProductId");
+
+ b.ToTable("Items");
+ });
+
+ modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", b =>
+ {
+ b.Property("ManufacturerId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ManufacturerId"));
+
+ b.Property("ManufacturerName")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("ManufacturerId");
+
+ b.ToTable("Manufacturers");
+ });
+
+ modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
+ {
+ b.Property("ProductId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProductId"));
+
+ b.Property("Category")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("ImageProduct")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("ManufacturerId")
+ .HasColumnType("int");
+
+ b.Property("ModelNo")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("ProductName")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("QuantityProduct")
+ .HasColumnType("int");
+
+ b.HasKey("ProductId");
+
+ b.HasIndex("ManufacturerId");
+
+ b.ToTable("Products");
+ });
+
+ modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.SupplierModel", b =>
+ {
+ b.Property("SupplierId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SupplierId"));
+
+ b.Property("SupplierEmail")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("SupplierGender")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("SupplierName")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("SupplierPhoneNo")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("SupplierId");
+
+ b.ToTable("Suppliers");
+ });
+
+ modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b =>
+ {
+ b.Property("SettingId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SettingId"));
+
+ b.Property("AllowedUserType")
+ .HasColumnType("longtext");
+
+ b.Property("Description")
+ .HasColumnType("longtext");
+
+ b.Property("MethodAllowedUserType")
+ .HasColumnType("json");
+
+ b.Property("ModuleName")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("varchar(50)");
+
+ b.Property("ModuleStatus")
+ .HasColumnType("int");
+
+ b.HasKey("SettingId");
+
+ b.ToTable("ModuleSettings");
+ });
+
+ modelBuilder.Entity("PSTW_CentralSystem.Models.RoleModel", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("longtext");
+
+ b.Property("Description")
+ .HasColumnType("longtext");
+
+ b.Property("Name")
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)");
+
+ b.Property("NormalizedName")
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasDatabaseName("RoleNameIndex");
+
+ b.ToTable("AspNetRoles", (string)null);
+
+ b.HasData(
+ new
+ {
+ Id = 1,
+ Description = "Can access all pages",
+ Name = "SuperAdmin",
+ NormalizedName = "SUPERADMIN"
+ },
+ new
+ {
+ Id = 2,
+ Description = "Can access some admin pages",
+ Name = "SystemAdmin",
+ NormalizedName = "SYSTEMADMIN"
+ },
+ new
+ {
+ Id = 3,
+ Description = "Can access operation pages",
+ Name = "Engineer",
+ NormalizedName = "ENGINEER"
+ },
+ new
+ {
+ Id = 4,
+ Description = "Can access data viewer pages",
+ Name = "Observer",
+ NormalizedName = "OBSERVER"
+ });
+ });
+
+ modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
+
+ b.Property("AccessFailedCount")
+ .HasColumnType("int");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("longtext");
+
+ b.Property("Email")
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)");
+
+ b.Property("EmailConfirmed")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("FullName")
+ .HasColumnType("longtext");
+
+ b.Property("LockoutEnabled")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("LockoutEnd")
+ .HasColumnType("datetime(6)");
+
+ b.Property("NormalizedEmail")
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)");
+
+ b.Property("NormalizedUserName")
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)");
+
+ b.Property("PasswordHash")
+ .HasColumnType("longtext");
+
+ b.Property("PhoneNumber")
+ .HasColumnType("longtext");
+
+ b.Property("PhoneNumberConfirmed")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("SecurityStamp")
+ .HasColumnType("longtext");
+
+ b.Property("TwoFactorEnabled")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)");
+
+ b.Property("UserStatus")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedEmail")
+ .HasDatabaseName("EmailIndex");
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasDatabaseName("UserNameIndex");
+
+ b.ToTable("AspNetUsers", (string)null);
+
+ b.HasData(
+ new
+ {
+ Id = 1,
+ AccessFailedCount = 0,
+ ConcurrencyStamp = "9577ec05-b14b-4fe2-9d75-cb6aa1ce25be",
+ Email = "admin@pstw.com.my",
+ EmailConfirmed = true,
+ FullName = "MAAdmin",
+ LockoutEnabled = false,
+ NormalizedEmail = "ADMIN@PSTW.COM.MY",
+ NormalizedUserName = "ADMIN@PSTW.COM.MY",
+ PasswordHash = "AQAAAAIAAYagAAAAEKPk6s6BTBEv5y5S9pOYk6OvLO6XfHhiylslKoOPbAQIAaG9DJZ27ltRHKwe34Na6w==",
+ PhoneNumberConfirmed = false,
+ SecurityStamp = "8f828c08-90d7-4a77-a8b0-a317e7ecadbc",
+ TwoFactorEnabled = false,
+ UserName = "admin@pstw.com.my"
+ },
+ new
+ {
+ Id = 2,
+ AccessFailedCount = 0,
+ ConcurrencyStamp = "75cb87bb-bba0-410e-83a0-b23b54dfa2f6",
+ Email = "sysadmin@pstw.com.my",
+ EmailConfirmed = true,
+ FullName = "SysAdmin",
+ LockoutEnabled = false,
+ NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
+ NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
+ PasswordHash = "AQAAAAIAAYagAAAAEPmeMMNew971MNbCbXypkCQ9L2EFXyjcFUhEjX7aPJCC4B+aRavO/201MVOvU/VFIQ==",
+ PhoneNumberConfirmed = false,
+ SecurityStamp = "4480b7af-adbc-4d83-9527-511f99593aac",
+ TwoFactorEnabled = false,
+ UserName = "sysadmin@pstw.com.my"
+ });
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
+ {
+ b.HasOne("PSTW_CentralSystem.Models.RoleModel", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
+ {
+ b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
+ {
+ b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
+ {
+ b.HasOne("PSTW_CentralSystem.Models.RoleModel", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
+ {
+ b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b =>
+ {
+ b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company")
+ .WithMany("Departments")
+ .HasForeignKey("CompanyId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Company");
+ });
+
+ modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
+ {
+ b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company")
+ .WithMany()
+ .HasForeignKey("CompanyId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", "Department")
+ .WithMany()
+ .HasForeignKey("DepartmentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", "Product")
+ .WithMany("Items")
+ .HasForeignKey("ProductId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Company");
+
+ b.Navigation("Department");
+
+ b.Navigation("Product");
+ });
+
+ modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
+ {
+ b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", "Manufacturer")
+ .WithMany()
+ .HasForeignKey("ManufacturerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Manufacturer");
+ });
+
+ modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b =>
+ {
+ b.Navigation("Departments");
+ });
+
+ modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
+ {
+ b.Navigation("Items");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Migrations/20241129023507_UpdateItemModel.cs b/Migrations/20241129023507_UpdateItemModel.cs
new file mode 100644
index 0000000..0e7a19d
--- /dev/null
+++ b/Migrations/20241129023507_UpdateItemModel.cs
@@ -0,0 +1,74 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace PSTW_CentralSystem.Migrations
+{
+ ///
+ public partial class UpdateItemModel : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AlterColumn(
+ name: "SerialNumber",
+ table: "Items",
+ type: "longtext",
+ nullable: true,
+ oldClrType: typeof(string),
+ oldType: "longtext")
+ .Annotation("MySql:CharSet", "utf8mb4")
+ .OldAnnotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.UpdateData(
+ table: "AspNetUsers",
+ keyColumn: "Id",
+ keyValue: 1,
+ columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
+ values: new object[] { "9577ec05-b14b-4fe2-9d75-cb6aa1ce25be", "AQAAAAIAAYagAAAAEKPk6s6BTBEv5y5S9pOYk6OvLO6XfHhiylslKoOPbAQIAaG9DJZ27ltRHKwe34Na6w==", "8f828c08-90d7-4a77-a8b0-a317e7ecadbc" });
+
+ migrationBuilder.UpdateData(
+ table: "AspNetUsers",
+ keyColumn: "Id",
+ keyValue: 2,
+ columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
+ values: new object[] { "75cb87bb-bba0-410e-83a0-b23b54dfa2f6", "AQAAAAIAAYagAAAAEPmeMMNew971MNbCbXypkCQ9L2EFXyjcFUhEjX7aPJCC4B+aRavO/201MVOvU/VFIQ==", "4480b7af-adbc-4d83-9527-511f99593aac" });
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.UpdateData(
+ table: "Items",
+ keyColumn: "SerialNumber",
+ keyValue: null,
+ column: "SerialNumber",
+ value: "");
+
+ migrationBuilder.AlterColumn(
+ name: "SerialNumber",
+ table: "Items",
+ type: "longtext",
+ nullable: false,
+ oldClrType: typeof(string),
+ oldType: "longtext",
+ oldNullable: true)
+ .Annotation("MySql:CharSet", "utf8mb4")
+ .OldAnnotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.UpdateData(
+ table: "AspNetUsers",
+ keyColumn: "Id",
+ keyValue: 1,
+ columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
+ values: new object[] { "df01136b-c869-4bc3-9512-34a9cdc8f73d", "AQAAAAIAAYagAAAAECcU3fIsIpqE1gECPg262gMejQiypGUXipVbiRtF66ywBqUHdohCj89hiJAafOlrPQ==", "d36451ff-cfab-46e1-bf80-6b428d79a19b" });
+
+ migrationBuilder.UpdateData(
+ table: "AspNetUsers",
+ keyColumn: "Id",
+ keyValue: 2,
+ columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
+ values: new object[] { "6f7244cf-e611-4088-890a-72939cfbefa5", "AQAAAAIAAYagAAAAEJwGvD0ionYUADG6FQvuXiK0/897GSnJ8z55w1P0GaItbNjjypF1+aDuRViCZMUQ+g==", "50df1ec2-4ba7-4eb5-84a3-ffb35b44f391" });
+ }
+ }
+}
diff --git a/Migrations/AuthDBContextModelSnapshot.cs b/Migrations/AuthDBContextModelSnapshot.cs
index 817a734..a6b3053 100644
--- a/Migrations/AuthDBContextModelSnapshot.cs
+++ b/Migrations/AuthDBContextModelSnapshot.cs
@@ -221,7 +221,6 @@ namespace PSTW_CentralSystem.Migrations
.HasColumnType("int");
b.Property("SerialNumber")
- .IsRequired()
.HasColumnType("longtext");
b.Property("Supplier")
@@ -498,16 +497,16 @@ namespace PSTW_CentralSystem.Migrations
{
Id = 1,
AccessFailedCount = 0,
- ConcurrencyStamp = "df01136b-c869-4bc3-9512-34a9cdc8f73d",
+ ConcurrencyStamp = "9577ec05-b14b-4fe2-9d75-cb6aa1ce25be",
Email = "admin@pstw.com.my",
EmailConfirmed = true,
FullName = "MAAdmin",
LockoutEnabled = false,
NormalizedEmail = "ADMIN@PSTW.COM.MY",
NormalizedUserName = "ADMIN@PSTW.COM.MY",
- PasswordHash = "AQAAAAIAAYagAAAAECcU3fIsIpqE1gECPg262gMejQiypGUXipVbiRtF66ywBqUHdohCj89hiJAafOlrPQ==",
+ PasswordHash = "AQAAAAIAAYagAAAAEKPk6s6BTBEv5y5S9pOYk6OvLO6XfHhiylslKoOPbAQIAaG9DJZ27ltRHKwe34Na6w==",
PhoneNumberConfirmed = false,
- SecurityStamp = "d36451ff-cfab-46e1-bf80-6b428d79a19b",
+ SecurityStamp = "8f828c08-90d7-4a77-a8b0-a317e7ecadbc",
TwoFactorEnabled = false,
UserName = "admin@pstw.com.my"
},
@@ -515,16 +514,16 @@ namespace PSTW_CentralSystem.Migrations
{
Id = 2,
AccessFailedCount = 0,
- ConcurrencyStamp = "6f7244cf-e611-4088-890a-72939cfbefa5",
+ ConcurrencyStamp = "75cb87bb-bba0-410e-83a0-b23b54dfa2f6",
Email = "sysadmin@pstw.com.my",
EmailConfirmed = true,
FullName = "SysAdmin",
LockoutEnabled = false,
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
- PasswordHash = "AQAAAAIAAYagAAAAEJwGvD0ionYUADG6FQvuXiK0/897GSnJ8z55w1P0GaItbNjjypF1+aDuRViCZMUQ+g==",
+ PasswordHash = "AQAAAAIAAYagAAAAEPmeMMNew971MNbCbXypkCQ9L2EFXyjcFUhEjX7aPJCC4B+aRavO/201MVOvU/VFIQ==",
PhoneNumberConfirmed = false,
- SecurityStamp = "50df1ec2-4ba7-4eb5-84a3-ffb35b44f391",
+ SecurityStamp = "4480b7af-adbc-4d83-9527-511f99593aac",
TwoFactorEnabled = false,
UserName = "sysadmin@pstw.com.my"
});
diff --git a/Views/Shared/_Layout.cshtml b/Views/Shared/_Layout.cshtml
index 17beadf..aebbb18 100644
--- a/Views/Shared/_Layout.cshtml
+++ b/Views/Shared/_Layout.cshtml
@@ -32,7 +32,6 @@
-
@* *@
@@ -685,7 +684,7 @@
-
+ @* *@
@@ -710,7 +709,6 @@
-
@await RenderSectionAsync("Scripts", required: false)