From 3882c41461bb76ba66c11946d0e30e04e5c512c6 Mon Sep 17 00:00:00 2001 From: srujitha <srujitha.vutla@pal.tech> Date: Wed, 27 Nov 2024 12:09:34 +0530 Subject: [PATCH 1/4] Added DbSchema --- LoanApplication.Db/Data/DataContext.cs | 1092 +++++++++++++++++ LoanApplication.Db/Entities/Applicant.cs | 35 + .../Entities/ApplicantCategory.cs | 21 + LoanApplication.Db/Entities/Document.cs | 21 + .../Entities/DocumentDetails.cs | 23 + LoanApplication.Db/Entities/LoanCategory.cs | 24 + .../Entities/LoanEligibility.cs | 31 + LoanApplication.Db/Entities/LoanPurpose.cs | 26 + LoanApplication.Db/Entities/LoanType.cs | 29 + LoanApplication.Db/Entities/Role.cs | 20 + LoanApplication.Db/Entities/Status.cs | 22 + LoanApplication.Db/Entities/User.cs | 24 + 12 files changed, 1368 insertions(+) create mode 100644 LoanApplication.Db/Data/DataContext.cs create mode 100644 LoanApplication.Db/Entities/Applicant.cs create mode 100644 LoanApplication.Db/Entities/ApplicantCategory.cs create mode 100644 LoanApplication.Db/Entities/Document.cs create mode 100644 LoanApplication.Db/Entities/DocumentDetails.cs create mode 100644 LoanApplication.Db/Entities/LoanCategory.cs create mode 100644 LoanApplication.Db/Entities/LoanEligibility.cs create mode 100644 LoanApplication.Db/Entities/LoanPurpose.cs create mode 100644 LoanApplication.Db/Entities/LoanType.cs create mode 100644 LoanApplication.Db/Entities/Role.cs create mode 100644 LoanApplication.Db/Entities/Status.cs create mode 100644 LoanApplication.Db/Entities/User.cs diff --git a/LoanApplication.Db/Data/DataContext.cs b/LoanApplication.Db/Data/DataContext.cs new file mode 100644 index 0000000..7a56f1e --- /dev/null +++ b/LoanApplication.Db/Data/DataContext.cs @@ -0,0 +1,1092 @@ +using System; +using System.Collections.Generic; +using System.Data; +using LoanApplication.Db.Entities; +using LoanApplication.Utilities.Enums; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Diagnostics; + +namespace LoanApplication.Db +{ + public class DataContext : DbContext + { + public DataContext(DbContextOptions<DataContext> options) : base(options) + { + } + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + optionsBuilder.ConfigureWarnings(warnings => warnings.Ignore(RelationalEventId.PendingModelChangesWarning)); + } + public DbSet<User> Users { get; set; } + public DbSet<Role> Roles { get; set; } + public DbSet<Applicant> Applicants { get; set; } + public DbSet<Document> Documents { get; set; } + public DbSet<DocumentDetails> DocumentDetails { get; set; } + public DbSet<ApplicantCategory> ApplicantCategories { get; set; } + public DbSet<LoanEligibility> LoanEligibilities { get; set; } + public DbSet<LoanPurpose> LoanPurposes { get; set; } + public DbSet<LoanCategory> LoanCategories { get; set; } + public DbSet<LoanType> LoanTypes { get; set; } + public DbSet<Status> Status { get; set; } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + modelBuilder.Entity<ApplicantCategory>() + .Property(ac => ac.ApplicantCategoryName) + .HasConversion( + v => v.ToString(), + v => (ApplicantCategoryName)Enum.Parse(typeof(ApplicantCategoryName), v) + ); + modelBuilder.Entity<Document>() + .Property(d => d.DocumentName) + .HasConversion( + v => v.ToString(), + v => (DocumentName)Enum.Parse(typeof(DocumentName), v) + ); + modelBuilder.Entity<LoanCategory>() + .Property(lc => lc.LoanCategoryName) + .HasConversion( + v => v.ToString(), + v => (LoanCategoryName)Enum.Parse(typeof(LoanCategoryName), v) + ); + modelBuilder.Entity<LoanPurpose>() + .Property(lp => lp.LoanPurposeName) + .HasConversion( + v => v.ToString(), + v => (LoanPurposeName)Enum.Parse(typeof(LoanPurposeName), v) + ); + modelBuilder.Entity<LoanType>() + .Property(lt => lt.LoanTypeName) + .HasConversion( + v => v.ToString(), + v => (LoanTypeName)Enum.Parse(typeof(LoanTypeName), v) + ); + modelBuilder.Entity<Role>() + .Property(r => r.RoleName) + .HasConversion( + v => v.ToString(), + v => (RoleName)Enum.Parse(typeof(RoleName), v) + ); + modelBuilder.Entity<Status>() + .Property(s => s.StatusName) + .HasConversion( + v => v.ToString(), + v => (StatusName)Enum.Parse(typeof(StatusName), v) + ); + modelBuilder.Entity<User>() + .HasOne(u=>u.Role) + .WithMany(r=>r.Users) + .HasForeignKey(u=>u.RoleId) + .OnDelete(DeleteBehavior.Restrict); + // Applicant and User + modelBuilder.Entity<Applicant>() + .HasOne(a => a.User) + .WithMany(u => u.Applicants) + .HasForeignKey(a => a.UserId) + .OnDelete(DeleteBehavior.Cascade); // if user deleted, deletes applicant + + modelBuilder.Entity<Applicant>() + .HasMany(a=>a.DocumentDetails) + .WithOne(dd=>dd.Applicant) + .HasForeignKey(dd=>dd.ApplicantId) + .OnDelete(DeleteBehavior.Cascade); + + + // Applicant and ApplicantCategory + modelBuilder.Entity<Applicant>() + .HasOne(a => a.ApplicantCategory) + .WithMany(ac => ac.Applicants) + .HasForeignKey(a => a.ApplicantCategoryId) + .OnDelete(DeleteBehavior.Restrict); //if u r trying to delete any applicantcategory,it throws exception if any applicant is associated with it + //before deleting applicantcategory, 1st make sure that any applicants associated with it are deleted/ points to another applicant category + + // Applicant and Status + modelBuilder.Entity<Applicant>() + .HasOne(a => a.ApplicationStatus) + .WithMany(s => s.Applicants) + .HasForeignKey(a => a.StatusId) + .OnDelete(DeleteBehavior.Restrict); + + modelBuilder.Entity<DocumentDetails>() + .HasOne(a => a.DocumentVerificationStatus) + .WithMany(s => s.DocumentDetails) + .HasForeignKey(a => a.StatusId) + .OnDelete(DeleteBehavior.Restrict); + + // Applicant and LoanType + modelBuilder.Entity<Applicant>() + .HasOne(a => a.LoanType) + .WithMany(lt => lt.Applicants) + .HasForeignKey(a => a.LoanTypeId) + .OnDelete(DeleteBehavior.Restrict); + + // Applicant and LoanPurpose + modelBuilder.Entity<Applicant>() + .HasOne(a => a.LoanPurpose) + .WithMany(lp => lp.Applicants) + .HasForeignKey(a => a.LoanPurposeId) + .OnDelete(DeleteBehavior.Restrict); + + // Applicant and LoanCategory + modelBuilder.Entity<Applicant>() + .HasOne(a => a.LoanCategory) + .WithMany(lc => lc.Applicants) + .HasForeignKey(a => a.LoanCategoryId) + .OnDelete(DeleteBehavior.Restrict); + + // DocumentDetails and Applicant + // modelBuilder.Entity<DocumentDetails>() + // .HasOne(dd => dd.Applicant) + // .WithMany(a => a.DocumentDetails) + // .HasForeignKey(dd => dd.ApplicantId) + // .OnDelete(DeleteBehavior.Restrict); + + // Document and DocumentDetails + modelBuilder.Entity<Document>() + .HasMany(d => d.DocumentDetails) + .WithOne(dd => dd.Document) + .HasForeignKey(dd => dd.DocumentId); + + + // LoanEligibility and ApplicantCategory + modelBuilder.Entity<LoanEligibility>() + .HasOne(le => le.ApplicantCategory) + .WithMany(ac => ac.LoanEligibilities) + .HasForeignKey(le => le.ApplicantCategoryId) + .OnDelete(DeleteBehavior.Restrict); + + // LoanEligibility and LoanType + modelBuilder.Entity<LoanEligibility>() + .HasOne(le => le.LoanType) + .WithMany(lt => lt.LoanEligibilities) + .HasForeignKey(le => le.LoanTypeId) + .OnDelete(DeleteBehavior.Restrict); + + // LoanEligibility and LoanPurpose + modelBuilder.Entity<LoanEligibility>() + .HasOne(le => le.LoanPurpose) + .WithMany(lp => lp.LoanEligibilities) + .HasForeignKey(le => le.LoanPurposeId) + .OnDelete(DeleteBehavior.Restrict); + + // LoanEligibility and LoanCategory + modelBuilder.Entity<LoanEligibility>() + .HasOne(le => le.LoanCategory) + .WithMany(lc => lc.LoanEligibilities) + .HasForeignKey(le => le.LoanCategoryId) + .OnDelete(DeleteBehavior.Restrict); + + + modelBuilder.Entity<LoanType>() + .HasMany(lt => lt.LoanCategories) + .WithOne(lc => lc.LoanType) + .HasForeignKey(lc => lc.LoanTypeId) + .OnDelete(DeleteBehavior.Restrict); // Prevent cascading delete + + // LoanType and LoanPurpose + modelBuilder.Entity<LoanType>() + .HasMany(lt => lt.LoanPurposes) + .WithOne(lp => lp.LoanType) + .HasForeignKey(lp => lp.LoanTypeId) + .OnDelete(DeleteBehavior.Restrict); // Prevent cascading delete + + // LoanCategory and LoanEligibility + modelBuilder.Entity<LoanCategory>() + .HasMany(lc => lc.LoanEligibilities) + .WithOne(le => le.LoanCategory) + .HasForeignKey(le => le.LoanCategoryId) + .OnDelete(DeleteBehavior.Restrict); // Prevent cascading delete + + // LoanPurpose and LoanEligibility + modelBuilder.Entity<LoanPurpose>() + .HasMany(lp => lp.LoanEligibilities) + .WithOne(le => le.LoanPurpose) + .HasForeignKey(le => le.LoanPurposeId) + .OnDelete(DeleteBehavior.Restrict); // Prevent cascading delete + + + modelBuilder.Entity<LoanEligibility>(entity => + { + + entity.Property(e => e.MinimumLoanAmount) + .HasColumnType("decimal(18,2)"); + + entity.Property(e => e.MaximumLoanAmount) + .HasColumnType("decimal(18,2)"); + + entity.Property(e => e.InterestStartsFrom) + .HasColumnType("decimal(5,2)"); + }); + modelBuilder.Entity<Role>().HasData( + new Role{ Id = 1, RoleName = RoleName.SuperAdmin, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new Role{ Id = 2, RoleName = RoleName.Admin, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new Role{ Id = 3, RoleName = RoleName.User, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1} + ); + modelBuilder.Entity<Status>().HasData( + new Status { Id = 1, StatusName = StatusName.New , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new Status { Id = 2, StatusName = StatusName.Pending , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new Status { Id = 3, StatusName = StatusName.Approved , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new Status { Id = 4, StatusName = StatusName.Rejected , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1} + ); + modelBuilder.Entity<ApplicantCategory>().HasData( + new ApplicantCategory { Id = 1, ApplicantCategoryName= ApplicantCategoryName.Student , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new ApplicantCategory { Id = 2, ApplicantCategoryName= ApplicantCategoryName.Employed , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new ApplicantCategory { Id = 3, ApplicantCategoryName= ApplicantCategoryName.UnEmployed, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new ApplicantCategory { Id = 4, ApplicantCategoryName= ApplicantCategoryName.Entrepreneur, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1} + + ); + modelBuilder.Entity<LoanType>().HasData( + new LoanType { Id = 1, LoanTypeName= LoanTypeName.Education , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanType { Id = 2, LoanTypeName= LoanTypeName.Gold , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanType { Id = 3, LoanTypeName= LoanTypeName.Home , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanType { Id = 4, LoanTypeName= LoanTypeName.Vehicle , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1} + ); + modelBuilder.Entity<LoanPurpose>().HasData( + new LoanPurpose{ Id = 1, LoanPurposeName= LoanPurposeName.Abroad, LoanTypeId=1 , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanPurpose{ Id = 2, LoanPurposeName= LoanPurposeName.PostGraduation, LoanTypeId=1, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanPurpose{ Id = 3, LoanPurposeName= LoanPurposeName.UnderGraduation, LoanTypeId=1 , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanPurpose{ Id = 4, LoanPurposeName= LoanPurposeName.ChildrenEducation, LoanTypeId=2, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanPurpose{ Id = 5, LoanPurposeName= LoanPurposeName.GoldLoanForBusiness, LoanTypeId=2 , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanPurpose{ Id = 6, LoanPurposeName= LoanPurposeName.Build, LoanTypeId=3 , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanPurpose{ Id = 7, LoanPurposeName= LoanPurposeName.Buy, LoanTypeId=3 , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanPurpose{ Id = 8, LoanPurposeName= LoanPurposeName.Renovation, LoanTypeId=3, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanPurpose{ Id = 9, LoanPurposeName= LoanPurposeName.VehicleLoanForBusiness, LoanTypeId=4, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanPurpose{ Id = 10, LoanPurposeName= LoanPurposeName.PersonalUsage, LoanTypeId=4 , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1} + ); + modelBuilder.Entity<LoanCategory>().HasData( + new LoanCategory{ Id = 1,LoanCategoryName= LoanCategoryName.Merit, LoanTypeId=1, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanCategory{ Id = 2,LoanCategoryName= LoanCategoryName.Demerit, LoanTypeId=1 , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanCategory{ Id = 3,LoanCategoryName= LoanCategoryName.Gold18k, LoanTypeId=2 , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanCategory{ Id = 4,LoanCategoryName= LoanCategoryName.Gold22k, LoanTypeId=2, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanCategory{ Id = 5,LoanCategoryName= LoanCategoryName.Gold24k, LoanTypeId=2 , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanCategory{ Id = 6,LoanCategoryName= LoanCategoryName.WithPlot, LoanTypeId=3, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanCategory{ Id = 7,LoanCategoryName= LoanCategoryName.WithoutPlot, LoanTypeId=3 , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanCategory{ Id = 8,LoanCategoryName= LoanCategoryName.TwoWheeler, LoanTypeId=4, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanCategory{ Id = 9,LoanCategoryName= LoanCategoryName.ThreeWheeler, LoanTypeId=4, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new LoanCategory{ Id = 10,LoanCategoryName= LoanCategoryName.FourWheeler, LoanTypeId=4, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1} + ); + + + modelBuilder.Entity<Document>().HasData( + new Document{Id=1,DocumentName=DocumentName.PanCard , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new Document{Id=2,DocumentName=DocumentName.AadharCard, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new Document{Id=3,DocumentName=DocumentName.PassportSizePhoto, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new Document{Id=4,DocumentName=DocumentName.Last6MonthsBankStatement, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new Document{Id=5,DocumentName=DocumentName.EducationMemos, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new Document{Id=6,DocumentName=DocumentName.AdmissionLetter, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new Document{Id=7,DocumentName=DocumentName.MeritScore, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new Document{Id=8,DocumentName=DocumentName.GuardianIncomeProof, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new Document{Id=9,DocumentName=DocumentName.PaySlip, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new Document{Id=10,DocumentName=DocumentName.IncomeProof, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new Document{Id=11,DocumentName=DocumentName.PlotAddress, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new Document{Id=12,DocumentName=DocumentName.OwnerDocument, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new Document{Id=13,DocumentName=DocumentName.DrivingLicense, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, + new Document{Id=14,DocumentName=DocumentName.VehicleInsurence, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1} + ); + modelBuilder.Entity<LoanEligibility>().HasData( + new LoanEligibility + { + Id = 1, + ApplicantCategoryId = 1, + LoanTypeId = 1, + LoanPurposeId=1, + LoanCategoryId=1, + MinimumLoanAmount = 1000000, + MaximumLoanAmount = 5000000, + InterestStartsFrom = 4.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 2, + ApplicantCategoryId = 1, + LoanTypeId = 1, + LoanPurposeId=1, + LoanCategoryId=2, + MinimumLoanAmount = 500000, + MaximumLoanAmount = 5000000, + InterestStartsFrom = 5.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 3, + ApplicantCategoryId = 1, + LoanTypeId = 1, + LoanPurposeId=2, + LoanCategoryId=1, + MinimumLoanAmount = 100000, + MaximumLoanAmount = 1000000, + InterestStartsFrom = 3.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 4, + ApplicantCategoryId = 1, + LoanTypeId = 1, + LoanPurposeId=2, + LoanCategoryId=2, + MinimumLoanAmount = 50000, + MaximumLoanAmount = 500000, + InterestStartsFrom = 3.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 5, + ApplicantCategoryId = 1, + LoanTypeId = 1, + LoanPurposeId=3, + LoanCategoryId=1, + MinimumLoanAmount = 50000, + MaximumLoanAmount = 200000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 6, + ApplicantCategoryId = 1, + LoanTypeId = 1, + LoanPurposeId=3, + LoanCategoryId=2, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 7, + ApplicantCategoryId = 2, + LoanTypeId = 2, + LoanPurposeId=4, + LoanCategoryId=3, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 8, + ApplicantCategoryId = 2, + LoanTypeId = 2, + LoanPurposeId=4, + LoanCategoryId=4, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 9, + ApplicantCategoryId = 2, + LoanTypeId = 2, + LoanPurposeId=4, + LoanCategoryId=5, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 10, + ApplicantCategoryId = 2, + LoanTypeId = 2, + LoanPurposeId=5, + LoanCategoryId=3, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 11, + ApplicantCategoryId = 2, + LoanTypeId = 2, + LoanPurposeId=5, + LoanCategoryId=4, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 12, + ApplicantCategoryId = 2, + LoanTypeId = 2, + LoanPurposeId=5, + LoanCategoryId=5, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 13, + ApplicantCategoryId = 2, + LoanTypeId = 3, + LoanPurposeId=6, + LoanCategoryId=6, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 14, + ApplicantCategoryId = 2, + LoanTypeId = 3, + LoanPurposeId=6, + LoanCategoryId=7, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 15, + ApplicantCategoryId = 2, + LoanTypeId = 3, + LoanPurposeId=7, + LoanCategoryId=7, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 16, + ApplicantCategoryId = 2, + LoanTypeId = 3, + LoanPurposeId=8, + LoanCategoryId=7, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 17, + ApplicantCategoryId = 2, + LoanTypeId = 4, + LoanPurposeId=9, + LoanCategoryId=8, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 18, + ApplicantCategoryId = 2, + LoanTypeId = 4, + LoanPurposeId=9, + LoanCategoryId=9, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 19, + ApplicantCategoryId = 2, + LoanTypeId = 4, + LoanPurposeId=9, + LoanCategoryId=10, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 20, + ApplicantCategoryId = 2, + LoanTypeId = 4, + LoanPurposeId=10, + LoanCategoryId=8, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 21, + ApplicantCategoryId = 2, + LoanTypeId = 4, + LoanPurposeId=10, + LoanCategoryId=9, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 22, + ApplicantCategoryId = 2, + LoanTypeId = 4, + LoanPurposeId=10, + LoanCategoryId=10, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 23, + ApplicantCategoryId = 3, + LoanTypeId = 2, + LoanPurposeId=4, + LoanCategoryId=3, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 24, + ApplicantCategoryId = 3, + LoanTypeId = 2, + LoanPurposeId=4, + LoanCategoryId=4, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 25, + ApplicantCategoryId = 3, + LoanTypeId = 2, + LoanPurposeId=4, + LoanCategoryId=5, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 26, + ApplicantCategoryId = 3, + LoanTypeId = 2, + LoanPurposeId=5, + LoanCategoryId=3, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 27, + ApplicantCategoryId = 3, + LoanTypeId = 2, + LoanPurposeId=5, + LoanCategoryId=4, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 28, + ApplicantCategoryId = 3, + LoanTypeId = 2, + LoanPurposeId=5, + LoanCategoryId=5, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + + new LoanEligibility + { + Id = 29, + ApplicantCategoryId = 3, + LoanTypeId = 4, + LoanPurposeId=9, + LoanCategoryId=8, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 30, + ApplicantCategoryId = 3, + LoanTypeId = 4, + LoanPurposeId=9, + LoanCategoryId=9, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 31, + ApplicantCategoryId = 3, + LoanTypeId = 4, + LoanPurposeId=9, + LoanCategoryId=10, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + + new LoanEligibility + { + Id = 32, + ApplicantCategoryId = 3, + LoanTypeId = 4, + LoanPurposeId=10, + LoanCategoryId=8, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 33, + ApplicantCategoryId = 3, + LoanTypeId = 4, + LoanPurposeId=10, + LoanCategoryId=9, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 34, + ApplicantCategoryId = 3, + LoanTypeId = 4, + LoanPurposeId=10, + LoanCategoryId=10, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + //entrepreneur + new LoanEligibility + { + Id = 35, + ApplicantCategoryId = 4, + LoanTypeId = 2, + LoanPurposeId=4, + LoanCategoryId=3, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m , + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 36, + ApplicantCategoryId = 4, + LoanTypeId = 2, + LoanPurposeId=4, + LoanCategoryId=4, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 37, + ApplicantCategoryId = 4, + LoanTypeId = 2, + LoanPurposeId=4, + LoanCategoryId=5, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 38, + ApplicantCategoryId = 4, + LoanTypeId = 2, + LoanPurposeId=5, + LoanCategoryId=3, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m , + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 39, + ApplicantCategoryId = 4, + LoanTypeId = 2, + LoanPurposeId=5, + LoanCategoryId=4, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m , + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 40, + ApplicantCategoryId = 4, + LoanTypeId = 2, + LoanPurposeId=5, + LoanCategoryId=5, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 41, + ApplicantCategoryId = 4, + LoanTypeId = 3, + LoanPurposeId=6, + LoanCategoryId=6, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m , + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 42, + ApplicantCategoryId = 4, + LoanTypeId = 3, + LoanPurposeId=6, + LoanCategoryId=7, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m , + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 43, + ApplicantCategoryId = 4, + LoanTypeId = 3, + LoanPurposeId=7, + LoanCategoryId=7, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m , + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 44, + ApplicantCategoryId = 4, + LoanTypeId = 3, + LoanPurposeId=8, + LoanCategoryId=7, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m, + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow , + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 45, + ApplicantCategoryId = 4, + LoanTypeId = 4, + LoanPurposeId=9, + LoanCategoryId=8, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m , + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 46, + ApplicantCategoryId = 4, + LoanTypeId = 4, + LoanPurposeId=9, + LoanCategoryId=9, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m , + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 47, + ApplicantCategoryId = 4, + LoanTypeId = 4, + LoanPurposeId=9, + LoanCategoryId=10, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m , + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 48, + ApplicantCategoryId = 4, + LoanTypeId = 4, + LoanPurposeId=10, + LoanCategoryId=8, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m , + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 49, + ApplicantCategoryId = 4, + LoanTypeId = 4, + LoanPurposeId=10, + LoanCategoryId=9, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m , + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy=1, + UpdatedBy=1 + }, + new LoanEligibility + { + Id = 50, + ApplicantCategoryId = 4, + LoanTypeId = 4, + LoanPurposeId=10, + LoanCategoryId=10, + MinimumLoanAmount = 10000, + MaximumLoanAmount = 100000, + InterestStartsFrom = 2.0m , + IsActive = true, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow + } + ); + } + } +} \ No newline at end of file diff --git a/LoanApplication.Db/Entities/Applicant.cs b/LoanApplication.Db/Entities/Applicant.cs new file mode 100644 index 0000000..9734209 --- /dev/null +++ b/LoanApplication.Db/Entities/Applicant.cs @@ -0,0 +1,35 @@ +using System; +using System.Text.Json.Serialization; +using LoanApplication.Utilities.Enums; + +namespace LoanApplication.Db.Entities; + +public class Applicant +{ + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public int? CibilScore { get; set; } + public string PhoneNumber { get; set; } + public int LoanAmount { get; set; } + public string ApplicationStatusDescription { get; set; } + public DateOnly DateOfBirth { get; set; } + public bool IsActive { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime ModifiedAt { get; set; } + public User User { get; set; } + public int UserId { get; set; } + public ApplicantCategory ApplicantCategory { get; set; } + public int ApplicantCategoryId { get; set; } + public Status ApplicationStatus { get; set; } + public int StatusId { get; set; } + public LoanType LoanType { get; set; } + public int LoanTypeId { get; set; } + public LoanPurpose LoanPurpose { get; set; } + public int LoanPurposeId { get; set; } + public LoanCategory LoanCategory { get; set; } + public int LoanCategoryId { get; set; } + public List<DocumentDetails> DocumentDetails { get; set; } + public int? VerifiedBy{get;set;} + +} diff --git a/LoanApplication.Db/Entities/ApplicantCategory.cs b/LoanApplication.Db/Entities/ApplicantCategory.cs new file mode 100644 index 0000000..782da41 --- /dev/null +++ b/LoanApplication.Db/Entities/ApplicantCategory.cs @@ -0,0 +1,21 @@ +using System; +using System.Text.Json.Serialization; +using LoanApplication.Utilities.Enums; + +namespace LoanApplication.Db.Entities; + +public class ApplicantCategory +{ + public int Id{get;set;} + [JsonConverter(typeof(JsonStringEnumConverter))] + public ApplicantCategoryName ApplicantCategoryName{get;set;} + public List<Applicant> Applicants{get;set;} + public List<LoanEligibility> LoanEligibilities{get;set;} + public bool IsActive{get;set;} + public DateTime CreatedAt{get;set;} + public DateTime ModifiedAt{get;set;} + + //admin details + public int CreatedBy{get;set;} + public int UpdatedBy{get;set;} +} diff --git a/LoanApplication.Db/Entities/Document.cs b/LoanApplication.Db/Entities/Document.cs new file mode 100644 index 0000000..3839261 --- /dev/null +++ b/LoanApplication.Db/Entities/Document.cs @@ -0,0 +1,21 @@ +using System; +using System.Text.Json.Serialization; +using LoanApplication.Utilities.Enums; + +namespace LoanApplication.Db.Entities; + +public class Document +{ + public int Id{get;set;} + [JsonConverter(typeof(JsonStringEnumConverter))] + public DocumentName DocumentName{get;set;} + public List<LoanType> LoanTypes{get;set;} + + public List<DocumentDetails> DocumentDetails{get;set;} + public bool IsActive{get;set;} + public DateTime CreatedAt{get;set;} + public DateTime ModifiedAt{get;set;} + public int CreatedBy{get;set;} + public int UpdatedBy{get;set;} + +} diff --git a/LoanApplication.Db/Entities/DocumentDetails.cs b/LoanApplication.Db/Entities/DocumentDetails.cs new file mode 100644 index 0000000..3736011 --- /dev/null +++ b/LoanApplication.Db/Entities/DocumentDetails.cs @@ -0,0 +1,23 @@ +using System; +using System.Text.Json.Serialization; + +namespace LoanApplication.Db.Entities; + +public class DocumentDetails +{ + public int Id{get;set;} + public byte[] File{get;set;} + public string Comment{get;set;} + public Status DocumentVerificationStatus{get;set;} + public int StatusId{get;set;} + + public Applicant Applicant{get;set;} + public int ApplicantId{get;set;} + + public Document Document{get;set;} + public int DocumentId{get;set;} + public bool IsActive{get;set;} + public DateTime CreatedAt{get;set;} + public DateTime ModifiedAt{get;set;} + public int VerifiedBy{get;set;} +} diff --git a/LoanApplication.Db/Entities/LoanCategory.cs b/LoanApplication.Db/Entities/LoanCategory.cs new file mode 100644 index 0000000..f0dccfd --- /dev/null +++ b/LoanApplication.Db/Entities/LoanCategory.cs @@ -0,0 +1,24 @@ +using System; +using System.Text.Json.Serialization; +using LoanApplication.Utilities.Enums; + +namespace LoanApplication.Db.Entities; + +public class LoanCategory +{ + public int Id{get;set;} + [JsonConverter(typeof(JsonStringEnumConverter))] + public LoanCategoryName LoanCategoryName{get;set;} + public int LoanTypeId{get;set;} + + public LoanType LoanType{get;set;} + public List<LoanEligibility> LoanEligibilities{get;set;} + + public List<Applicant> Applicants{get;set;} + public bool IsActive{get;set;} + public DateTime CreatedAt{get;set;} + public DateTime ModifiedAt{get;set;} + //admin details + public int CreatedBy{get;set;} + public int UpdatedBy{get;set;} +} diff --git a/LoanApplication.Db/Entities/LoanEligibility.cs b/LoanApplication.Db/Entities/LoanEligibility.cs new file mode 100644 index 0000000..3575ce0 --- /dev/null +++ b/LoanApplication.Db/Entities/LoanEligibility.cs @@ -0,0 +1,31 @@ +using System; +using System.Data; +using System.Text.Json.Serialization; + +namespace LoanApplication.Db.Entities; + +public class LoanEligibility +{ + public int Id{get;set;} + public decimal MinimumLoanAmount { get; set; } + public decimal MaximumLoanAmount { get; set; } + public decimal InterestStartsFrom { get; set; } + public bool IsActive{get;set;} + public DateTime CreatedAt{get;set;} + public DateTime ModifiedAt{get;set;} + public int ApplicantCategoryId{get;set;} + + public ApplicantCategory ApplicantCategory{get;set;} + public int LoanTypeId{get;set;} + + public LoanType LoanType{get;set;} + public int LoanPurposeId{get;set;} + public LoanPurpose LoanPurpose{get;set;} + public int LoanCategoryId{get;set;} + + public LoanCategory LoanCategory{get;set;} + //admin details + public int CreatedBy{get;set;} + public int UpdatedBy{get;set;} + +} diff --git a/LoanApplication.Db/Entities/LoanPurpose.cs b/LoanApplication.Db/Entities/LoanPurpose.cs new file mode 100644 index 0000000..fac0d5c --- /dev/null +++ b/LoanApplication.Db/Entities/LoanPurpose.cs @@ -0,0 +1,26 @@ +using System; +using System.Text.Json.Serialization; +using LoanApplication.Utilities.Enums; + +namespace LoanApplication.Db.Entities; + +public class LoanPurpose +{ + public int Id{get;set;} + [JsonConverter(typeof(JsonStringEnumConverter))] + public LoanPurposeName LoanPurposeName{get;set;} + + public int LoanTypeId{get;set;} + + public LoanType LoanType{get;set;} + + public List<LoanEligibility> LoanEligibilities{get;set;} + + public List<Applicant> Applicants{get;set;} + public bool IsActive{get;set;} + public DateTime CreatedAt{get;set;} + public DateTime ModifiedAt{get;set;} + //admin details + public int CreatedBy{get;set;} + public int UpdatedBy{get;set;} +} diff --git a/LoanApplication.Db/Entities/LoanType.cs b/LoanApplication.Db/Entities/LoanType.cs new file mode 100644 index 0000000..302d382 --- /dev/null +++ b/LoanApplication.Db/Entities/LoanType.cs @@ -0,0 +1,29 @@ +using System; +using System.Text.Json.Serialization; +using LoanApplication.Utilities.Enums; + +namespace LoanApplication.Db.Entities; + +public class LoanType +{ + public int Id{get;set;} + [JsonConverter(typeof(JsonStringEnumConverter))] + public LoanTypeName LoanTypeName{get;set;} + + public List<Applicant> Applicants{get;set;} + + public List<Document> Documents{get;set;} + + public List<LoanEligibility> LoanEligibilities{get;set;} + + public List<LoanPurpose> LoanPurposes{get;set;} + + public List<LoanCategory> LoanCategories{get;set;} + public bool IsActive{get;set;} + public DateTime CreatedAt{get;set;} + public DateTime ModifiedAt{get;set;} + //admin details + public int CreatedBy{get;set;} + public int UpdatedBy{get;set;} + +} diff --git a/LoanApplication.Db/Entities/Role.cs b/LoanApplication.Db/Entities/Role.cs new file mode 100644 index 0000000..dd33d10 --- /dev/null +++ b/LoanApplication.Db/Entities/Role.cs @@ -0,0 +1,20 @@ +using System; +using System.Text.Json.Serialization; +using LoanApplication.Utilities.Enums; + +namespace LoanApplication.Db.Entities; + +public class Role +{ + public int Id{get;set;} + [JsonConverter(typeof(JsonStringEnumConverter))] + public RoleName RoleName{get;set;} + [JsonIgnore] + public List<User> Users{get;set;} + public bool IsActive{get;set;} + public DateTime CreatedAt{get;set;} + public DateTime ModifiedAt{get;set;} + //admin details + public int CreatedBy{get;set;} + public int UpdatedBy{get;set;} +} diff --git a/LoanApplication.Db/Entities/Status.cs b/LoanApplication.Db/Entities/Status.cs new file mode 100644 index 0000000..edd9867 --- /dev/null +++ b/LoanApplication.Db/Entities/Status.cs @@ -0,0 +1,22 @@ +using System; +using System.Text.Json.Serialization; +using LoanApplication.Utilities.Enums; + +namespace LoanApplication.Db.Entities; + +public class Status +{ + public int Id{get;set;} + [JsonConverter(typeof(JsonStringEnumConverter))] + public StatusName StatusName{get;set;} + + public List<Applicant> Applicants{get;set;} + + public List<DocumentDetails> DocumentDetails{get;set;} + public bool IsActive{get;set;} + public DateTime CreatedAt{get;set;} + public DateTime ModifiedAt{get;set;} + //admin details + public int CreatedBy{get;set;} + public int UpdatedBy{get;set;} +} diff --git a/LoanApplication.Db/Entities/User.cs b/LoanApplication.Db/Entities/User.cs new file mode 100644 index 0000000..b6d997a --- /dev/null +++ b/LoanApplication.Db/Entities/User.cs @@ -0,0 +1,24 @@ +using System; +using System.Text.Json.Serialization; + +namespace LoanApplication.Db.Entities +{ + public class User + { + public int Id { get; set; } + public string UserName { get; set; } + public string Email { get; set; } + public string Password { get; set; } + public int RoleId { get; set; } + public Role Role { get; set; } + + [JsonIgnore] + public List<Applicant> Applicants { get; set; } + public bool IsActive { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime ModifiedAt { get; set; } + public string PasswordResetToken { get; set; } + public DateTime? TokenExpiration { get; set; } + + } +} \ No newline at end of file -- GitLab From e75bf1b9389d5242734326fc60354e0b0ddea655 Mon Sep 17 00:00:00 2001 From: srujitha <srujitha.vutla@pal.tech> Date: Thu, 28 Nov 2024 21:56:33 +0530 Subject: [PATCH 2/4] Updated DbSchema --- LoanApplication.Db/Data/DataContext.cs | 1232 +++-------------- .../MasterData.cs/ApplicantCategorySeeder.cs | 39 + .../Data/MasterData.cs/DocumentSeeder.cs | 53 + .../Data/MasterData.cs/LoanCategorySeeder.cs | 50 + .../MasterData.cs/LoanEligibilitySeeder.cs | 95 ++ .../Data/MasterData.cs/LoanPurposeSeeder.cs | 47 + .../Data/MasterData.cs/LoanTypeSeeder.cs | 39 + .../Data/MasterData.cs/RoleSeeder.cs | 37 + .../Data/MasterData.cs/StatusSeeder.cs | 40 + LoanApplication.Db/Entities/Applicant.cs | 25 +- .../Entities/ApplicantCategory.cs | 24 +- LoanApplication.Db/Entities/Document.cs | 23 +- .../Entities/DocumentDetails.cs | 32 +- LoanApplication.Db/Entities/LoanCategory.cs | 31 +- .../Entities/LoanEligibility.cs | 23 +- LoanApplication.Db/Entities/LoanPurpose.cs | 34 +- LoanApplication.Db/Entities/LoanType.cs | 36 +- LoanApplication.Db/Entities/Role.cs | 20 +- LoanApplication.Db/Entities/Status.cs | 24 +- LoanApplication.Db/Entities/User.cs | 41 +- 20 files changed, 739 insertions(+), 1206 deletions(-) create mode 100644 LoanApplication.Db/Data/MasterData.cs/ApplicantCategorySeeder.cs create mode 100644 LoanApplication.Db/Data/MasterData.cs/DocumentSeeder.cs create mode 100644 LoanApplication.Db/Data/MasterData.cs/LoanCategorySeeder.cs create mode 100644 LoanApplication.Db/Data/MasterData.cs/LoanEligibilitySeeder.cs create mode 100644 LoanApplication.Db/Data/MasterData.cs/LoanPurposeSeeder.cs create mode 100644 LoanApplication.Db/Data/MasterData.cs/LoanTypeSeeder.cs create mode 100644 LoanApplication.Db/Data/MasterData.cs/RoleSeeder.cs create mode 100644 LoanApplication.Db/Data/MasterData.cs/StatusSeeder.cs diff --git a/LoanApplication.Db/Data/DataContext.cs b/LoanApplication.Db/Data/DataContext.cs index 7a56f1e..eddc358 100644 --- a/LoanApplication.Db/Data/DataContext.cs +++ b/LoanApplication.Db/Data/DataContext.cs @@ -1,1092 +1,210 @@ -using System; +using System; using System.Collections.Generic; using System.Data; -using LoanApplication.Db.Entities; -using LoanApplication.Utilities.Enums; +using LoanApplication.Db.Entities; +using LoanApplication.Db.Seeds; +using LoanApplication.Utilities.Enums; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Diagnostics; -namespace LoanApplication.Db -{ - public class DataContext : DbContext - { +namespace LoanApplication.Db +{ + public class DataContext : DbContext + { public DataContext(DbContextOptions<DataContext> options) : base(options) { } - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - { - optionsBuilder.ConfigureWarnings(warnings => warnings.Ignore(RelationalEventId.PendingModelChangesWarning)); - } - public DbSet<User> Users { get; set; } - public DbSet<Role> Roles { get; set; } - public DbSet<Applicant> Applicants { get; set; } - public DbSet<Document> Documents { get; set; } - public DbSet<DocumentDetails> DocumentDetails { get; set; } - public DbSet<ApplicantCategory> ApplicantCategories { get; set; } - public DbSet<LoanEligibility> LoanEligibilities { get; set; } - public DbSet<LoanPurpose> LoanPurposes { get; set; } - public DbSet<LoanCategory> LoanCategories { get; set; } - public DbSet<LoanType> LoanTypes { get; set; } - public DbSet<Status> Status { get; set; } - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - base.OnModelCreating(modelBuilder); - modelBuilder.Entity<ApplicantCategory>() - .Property(ac => ac.ApplicantCategoryName) - .HasConversion( - v => v.ToString(), - v => (ApplicantCategoryName)Enum.Parse(typeof(ApplicantCategoryName), v) - ); - modelBuilder.Entity<Document>() - .Property(d => d.DocumentName) - .HasConversion( - v => v.ToString(), - v => (DocumentName)Enum.Parse(typeof(DocumentName), v) - ); - modelBuilder.Entity<LoanCategory>() - .Property(lc => lc.LoanCategoryName) - .HasConversion( - v => v.ToString(), - v => (LoanCategoryName)Enum.Parse(typeof(LoanCategoryName), v) - ); - modelBuilder.Entity<LoanPurpose>() - .Property(lp => lp.LoanPurposeName) - .HasConversion( - v => v.ToString(), - v => (LoanPurposeName)Enum.Parse(typeof(LoanPurposeName), v) - ); - modelBuilder.Entity<LoanType>() - .Property(lt => lt.LoanTypeName) - .HasConversion( - v => v.ToString(), - v => (LoanTypeName)Enum.Parse(typeof(LoanTypeName), v) - ); - modelBuilder.Entity<Role>() - .Property(r => r.RoleName) - .HasConversion( - v => v.ToString(), - v => (RoleName)Enum.Parse(typeof(RoleName), v) + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + optionsBuilder.ConfigureWarnings(warnings => warnings.Ignore(RelationalEventId.PendingModelChangesWarning)); + } + public DbSet<User> Users { get; set; } + public DbSet<Role> Roles { get; set; } + public DbSet<Applicant> Applicants { get; set; } + public DbSet<Document> Documents { get; set; } + public DbSet<DocumentDetails> DocumentDetails { get; set; } + public DbSet<ApplicantCategory> ApplicantCategories { get; set; } + public DbSet<LoanEligibility> LoanEligibilities { get; set; } + public DbSet<LoanPurpose> LoanPurposes { get; set; } + public DbSet<LoanCategory> LoanCategories { get; set; } + public DbSet<LoanType> LoanTypes { get; set; } + public DbSet<Status> Status { get; set; } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + modelBuilder.Entity<ApplicantCategory>() + .Property(ac => ac.ApplicantCategoryName) + .HasConversion( + v => v.ToString(), + v => (ApplicantCategoryName)Enum.Parse(typeof(ApplicantCategoryName), v) + ); + + modelBuilder.Entity<Document>() + .Property(d => d.DocumentName) + .HasConversion( + v => v.ToString(), + v => (DocumentName)Enum.Parse(typeof(DocumentName), v) + ); + modelBuilder.Entity<LoanCategory>() + .Property(lc => lc.LoanCategoryName) + .HasConversion( + v => v.ToString(), + v => (LoanCategoryName)Enum.Parse(typeof(LoanCategoryName), v) + ); + modelBuilder.Entity<LoanPurpose>() + .Property(lp => lp.LoanPurposeName) + .HasConversion( + v => v.ToString(), + v => (LoanPurposeName)Enum.Parse(typeof(LoanPurposeName), v) + ); + modelBuilder.Entity<LoanType>() + .Property(lt => lt.LoanTypeName) + .HasConversion( + v => v.ToString(), + v => (LoanTypeName)Enum.Parse(typeof(LoanTypeName), v) + ); + modelBuilder.Entity<Role>() + .Property(r => r.RoleName) + .HasConversion( + v => v.ToString(), + v => (RoleName)Enum.Parse(typeof(RoleName), v) ); - modelBuilder.Entity<Status>() - .Property(s => s.StatusName) - .HasConversion( + + modelBuilder.Entity<Status>() + .Property(s => s.StatusName) + .HasConversion( v => v.ToString(), - v => (StatusName)Enum.Parse(typeof(StatusName), v) - ); + v => (StatusName)Enum.Parse(typeof(StatusName), v) + ); modelBuilder.Entity<User>() - .HasOne(u=>u.Role) - .WithMany(r=>r.Users) - .HasForeignKey(u=>u.RoleId) - .OnDelete(DeleteBehavior.Restrict); - // Applicant and User - modelBuilder.Entity<Applicant>() - .HasOne(a => a.User) - .WithMany(u => u.Applicants) - .HasForeignKey(a => a.UserId) - .OnDelete(DeleteBehavior.Cascade); // if user deleted, deletes applicant + .HasOne(u => u.Role) + .WithMany(r => r.Users) + .HasForeignKey(u => u.RoleId) + .OnDelete(DeleteBehavior.Restrict); + + modelBuilder.Entity<Applicant>() + .HasOne(a => a.User) + .WithMany(u => u.Applicants) + .HasForeignKey(a => a.UserId) + .OnDelete(DeleteBehavior.Cascade); modelBuilder.Entity<Applicant>() - .HasMany(a=>a.DocumentDetails) - .WithOne(dd=>dd.Applicant) - .HasForeignKey(dd=>dd.ApplicantId) + .HasMany(a => a.DocumentDetails) + .WithOne(dd => dd.Applicant) + .HasForeignKey(dd => dd.ApplicantId) .OnDelete(DeleteBehavior.Cascade); - - // Applicant and ApplicantCategory - modelBuilder.Entity<Applicant>() - .HasOne(a => a.ApplicantCategory) - .WithMany(ac => ac.Applicants) - .HasForeignKey(a => a.ApplicantCategoryId) + modelBuilder.Entity<Applicant>() + .HasOne(a => a.ApplicantCategory) + .WithMany(ac => ac.Applicants) + .HasForeignKey(a => a.ApplicantCategoryId) .OnDelete(DeleteBehavior.Restrict); //if u r trying to delete any applicantcategory,it throws exception if any applicant is associated with it - //before deleting applicantcategory, 1st make sure that any applicants associated with it are deleted/ points to another applicant category + //before deleting applicantcategory, 1st make sure that any applicants associated with it are deleted/ points to another applicant category - // Applicant and Status - modelBuilder.Entity<Applicant>() - .HasOne(a => a.ApplicationStatus) - .WithMany(s => s.Applicants) - .HasForeignKey(a => a.StatusId) + modelBuilder.Entity<Applicant>() + .HasOne(a => a.ApplicationStatus) + .WithMany(s => s.Applicants) + .HasForeignKey(a => a.StatusId) .OnDelete(DeleteBehavior.Restrict); - modelBuilder.Entity<DocumentDetails>() - .HasOne(a => a.DocumentVerificationStatus) - .WithMany(s => s.DocumentDetails) - .HasForeignKey(a => a.StatusId) + modelBuilder.Entity<DocumentDetails>() + .HasOne(a => a.DocumentVerificationStatus) + .WithMany(s => s.DocumentDetails) + .HasForeignKey(a => a.StatusId) .OnDelete(DeleteBehavior.Restrict); - // Applicant and LoanType - modelBuilder.Entity<Applicant>() - .HasOne(a => a.LoanType) - .WithMany(lt => lt.Applicants) - .HasForeignKey(a => a.LoanTypeId) - .OnDelete(DeleteBehavior.Restrict); - - // Applicant and LoanPurpose - modelBuilder.Entity<Applicant>() - .HasOne(a => a.LoanPurpose) - .WithMany(lp => lp.Applicants) - .HasForeignKey(a => a.LoanPurposeId) - .OnDelete(DeleteBehavior.Restrict); + modelBuilder.Entity<Applicant>() + .HasOne(a => a.LoanType) + .WithMany(lt => lt.Applicants) + .HasForeignKey(a => a.LoanTypeId) + .OnDelete(DeleteBehavior.Restrict); - // Applicant and LoanCategory - modelBuilder.Entity<Applicant>() - .HasOne(a => a.LoanCategory) - .WithMany(lc => lc.Applicants) - .HasForeignKey(a => a.LoanCategoryId) - .OnDelete(DeleteBehavior.Restrict); - - // DocumentDetails and Applicant - // modelBuilder.Entity<DocumentDetails>() - // .HasOne(dd => dd.Applicant) - // .WithMany(a => a.DocumentDetails) - // .HasForeignKey(dd => dd.ApplicantId) - // .OnDelete(DeleteBehavior.Restrict); + modelBuilder.Entity<Applicant>() + .HasOne(a => a.LoanPurpose) + .WithMany(lp => lp.Applicants) + .HasForeignKey(a => a.LoanPurposeId) + .OnDelete(DeleteBehavior.Restrict); - // Document and DocumentDetails - modelBuilder.Entity<Document>() - .HasMany(d => d.DocumentDetails) - .WithOne(dd => dd.Document) - .HasForeignKey(dd => dd.DocumentId); + modelBuilder.Entity<Applicant>() + .HasOne(a => a.LoanCategory) + .WithMany(lc => lc.Applicants) + .HasForeignKey(a => a.LoanCategoryId) + .OnDelete(DeleteBehavior.Restrict); + modelBuilder.Entity<Document>() + .HasMany(d => d.DocumentDetails) + .WithOne(dd => dd.Document) + .HasForeignKey(dd => dd.DocumentId); - // LoanEligibility and ApplicantCategory - modelBuilder.Entity<LoanEligibility>() - .HasOne(le => le.ApplicantCategory) - .WithMany(ac => ac.LoanEligibilities) - .HasForeignKey(le => le.ApplicantCategoryId) - .OnDelete(DeleteBehavior.Restrict); + modelBuilder.Entity<LoanEligibility>() + .HasOne(le => le.ApplicantCategory) + .WithMany(ac => ac.LoanEligibilities) + .HasForeignKey(le => le.ApplicantCategoryId) + .OnDelete(DeleteBehavior.Restrict); - // LoanEligibility and LoanType - modelBuilder.Entity<LoanEligibility>() - .HasOne(le => le.LoanType) - .WithMany(lt => lt.LoanEligibilities) - .HasForeignKey(le => le.LoanTypeId) - .OnDelete(DeleteBehavior.Restrict); + modelBuilder.Entity<LoanEligibility>() + .HasOne(le => le.LoanType) + .WithMany(lt => lt.LoanEligibilities) + .HasForeignKey(le => le.LoanTypeId) + .OnDelete(DeleteBehavior.Restrict); - // LoanEligibility and LoanPurpose - modelBuilder.Entity<LoanEligibility>() - .HasOne(le => le.LoanPurpose) - .WithMany(lp => lp.LoanEligibilities) - .HasForeignKey(le => le.LoanPurposeId) - .OnDelete(DeleteBehavior.Restrict); + modelBuilder.Entity<LoanEligibility>() + .HasOne(le => le.LoanPurpose) + .WithMany(lp => lp.LoanEligibilities) + .HasForeignKey(le => le.LoanPurposeId) + .OnDelete(DeleteBehavior.Restrict); - // LoanEligibility and LoanCategory - modelBuilder.Entity<LoanEligibility>() - .HasOne(le => le.LoanCategory) - .WithMany(lc => lc.LoanEligibilities) - .HasForeignKey(le => le.LoanCategoryId) - .OnDelete(DeleteBehavior.Restrict); + modelBuilder.Entity<LoanEligibility>() + .HasOne(le => le.LoanCategory) + .WithMany(lc => lc.LoanEligibilities) + .HasForeignKey(le => le.LoanCategoryId) + .OnDelete(DeleteBehavior.Restrict); - - modelBuilder.Entity<LoanType>() - .HasMany(lt => lt.LoanCategories) - .WithOne(lc => lc.LoanType) - .HasForeignKey(lc => lc.LoanTypeId) - .OnDelete(DeleteBehavior.Restrict); // Prevent cascading delete + modelBuilder.Entity<LoanType>() + .HasMany(lt => lt.LoanCategories) + .WithOne(lc => lc.LoanType) + .HasForeignKey(lc => lc.LoanTypeId) + .OnDelete(DeleteBehavior.Restrict); - // LoanType and LoanPurpose - modelBuilder.Entity<LoanType>() - .HasMany(lt => lt.LoanPurposes) - .WithOne(lp => lp.LoanType) - .HasForeignKey(lp => lp.LoanTypeId) - .OnDelete(DeleteBehavior.Restrict); // Prevent cascading delete + modelBuilder.Entity<LoanType>() + .HasMany(lt => lt.LoanPurposes) + .WithOne(lp => lp.LoanType) + .HasForeignKey(lp => lp.LoanTypeId) + .OnDelete(DeleteBehavior.Restrict); - // LoanCategory and LoanEligibility - modelBuilder.Entity<LoanCategory>() - .HasMany(lc => lc.LoanEligibilities) - .WithOne(le => le.LoanCategory) - .HasForeignKey(le => le.LoanCategoryId) + modelBuilder.Entity<LoanCategory>() + .HasMany(lc => lc.LoanEligibilities) + .WithOne(le => le.LoanCategory) + .HasForeignKey(le => le.LoanCategoryId) .OnDelete(DeleteBehavior.Restrict); // Prevent cascading delete - // LoanPurpose and LoanEligibility - modelBuilder.Entity<LoanPurpose>() - .HasMany(lp => lp.LoanEligibilities) - .WithOne(le => le.LoanPurpose) - .HasForeignKey(le => le.LoanPurposeId) + modelBuilder.Entity<LoanPurpose>() + .HasMany(lp => lp.LoanEligibilities) + .WithOne(le => le.LoanPurpose) + .HasForeignKey(le => le.LoanPurposeId) .OnDelete(DeleteBehavior.Restrict); // Prevent cascading delete - - - modelBuilder.Entity<LoanEligibility>(entity => - { - - entity.Property(e => e.MinimumLoanAmount) - .HasColumnType("decimal(18,2)"); - entity.Property(e => e.MaximumLoanAmount) - .HasColumnType("decimal(18,2)"); - - entity.Property(e => e.InterestStartsFrom) - .HasColumnType("decimal(5,2)"); - }); - modelBuilder.Entity<Role>().HasData( - new Role{ Id = 1, RoleName = RoleName.SuperAdmin, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new Role{ Id = 2, RoleName = RoleName.Admin, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new Role{ Id = 3, RoleName = RoleName.User, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1} - ); - modelBuilder.Entity<Status>().HasData( - new Status { Id = 1, StatusName = StatusName.New , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new Status { Id = 2, StatusName = StatusName.Pending , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new Status { Id = 3, StatusName = StatusName.Approved , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new Status { Id = 4, StatusName = StatusName.Rejected , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1} - ); - modelBuilder.Entity<ApplicantCategory>().HasData( - new ApplicantCategory { Id = 1, ApplicantCategoryName= ApplicantCategoryName.Student , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new ApplicantCategory { Id = 2, ApplicantCategoryName= ApplicantCategoryName.Employed , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new ApplicantCategory { Id = 3, ApplicantCategoryName= ApplicantCategoryName.UnEmployed, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new ApplicantCategory { Id = 4, ApplicantCategoryName= ApplicantCategoryName.Entrepreneur, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1} - - ); - modelBuilder.Entity<LoanType>().HasData( - new LoanType { Id = 1, LoanTypeName= LoanTypeName.Education , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanType { Id = 2, LoanTypeName= LoanTypeName.Gold , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanType { Id = 3, LoanTypeName= LoanTypeName.Home , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanType { Id = 4, LoanTypeName= LoanTypeName.Vehicle , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1} - ); - modelBuilder.Entity<LoanPurpose>().HasData( - new LoanPurpose{ Id = 1, LoanPurposeName= LoanPurposeName.Abroad, LoanTypeId=1 , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanPurpose{ Id = 2, LoanPurposeName= LoanPurposeName.PostGraduation, LoanTypeId=1, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanPurpose{ Id = 3, LoanPurposeName= LoanPurposeName.UnderGraduation, LoanTypeId=1 , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanPurpose{ Id = 4, LoanPurposeName= LoanPurposeName.ChildrenEducation, LoanTypeId=2, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanPurpose{ Id = 5, LoanPurposeName= LoanPurposeName.GoldLoanForBusiness, LoanTypeId=2 , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanPurpose{ Id = 6, LoanPurposeName= LoanPurposeName.Build, LoanTypeId=3 , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanPurpose{ Id = 7, LoanPurposeName= LoanPurposeName.Buy, LoanTypeId=3 , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanPurpose{ Id = 8, LoanPurposeName= LoanPurposeName.Renovation, LoanTypeId=3, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanPurpose{ Id = 9, LoanPurposeName= LoanPurposeName.VehicleLoanForBusiness, LoanTypeId=4, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanPurpose{ Id = 10, LoanPurposeName= LoanPurposeName.PersonalUsage, LoanTypeId=4 , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1} - ); - modelBuilder.Entity<LoanCategory>().HasData( - new LoanCategory{ Id = 1,LoanCategoryName= LoanCategoryName.Merit, LoanTypeId=1, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanCategory{ Id = 2,LoanCategoryName= LoanCategoryName.Demerit, LoanTypeId=1 , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanCategory{ Id = 3,LoanCategoryName= LoanCategoryName.Gold18k, LoanTypeId=2 , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanCategory{ Id = 4,LoanCategoryName= LoanCategoryName.Gold22k, LoanTypeId=2, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanCategory{ Id = 5,LoanCategoryName= LoanCategoryName.Gold24k, LoanTypeId=2 , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanCategory{ Id = 6,LoanCategoryName= LoanCategoryName.WithPlot, LoanTypeId=3, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanCategory{ Id = 7,LoanCategoryName= LoanCategoryName.WithoutPlot, LoanTypeId=3 , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanCategory{ Id = 8,LoanCategoryName= LoanCategoryName.TwoWheeler, LoanTypeId=4, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanCategory{ Id = 9,LoanCategoryName= LoanCategoryName.ThreeWheeler, LoanTypeId=4, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new LoanCategory{ Id = 10,LoanCategoryName= LoanCategoryName.FourWheeler, LoanTypeId=4, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1} - ); - - - modelBuilder.Entity<Document>().HasData( - new Document{Id=1,DocumentName=DocumentName.PanCard , IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new Document{Id=2,DocumentName=DocumentName.AadharCard, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new Document{Id=3,DocumentName=DocumentName.PassportSizePhoto, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new Document{Id=4,DocumentName=DocumentName.Last6MonthsBankStatement, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new Document{Id=5,DocumentName=DocumentName.EducationMemos, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new Document{Id=6,DocumentName=DocumentName.AdmissionLetter, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new Document{Id=7,DocumentName=DocumentName.MeritScore, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new Document{Id=8,DocumentName=DocumentName.GuardianIncomeProof, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new Document{Id=9,DocumentName=DocumentName.PaySlip, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new Document{Id=10,DocumentName=DocumentName.IncomeProof, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new Document{Id=11,DocumentName=DocumentName.PlotAddress, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new Document{Id=12,DocumentName=DocumentName.OwnerDocument, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new Document{Id=13,DocumentName=DocumentName.DrivingLicense, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1}, - new Document{Id=14,DocumentName=DocumentName.VehicleInsurence, IsActive = true, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow,CreatedBy=1,UpdatedBy=1} - ); - modelBuilder.Entity<LoanEligibility>().HasData( - new LoanEligibility - { - Id = 1, - ApplicantCategoryId = 1, - LoanTypeId = 1, - LoanPurposeId=1, - LoanCategoryId=1, - MinimumLoanAmount = 1000000, - MaximumLoanAmount = 5000000, - InterestStartsFrom = 4.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 2, - ApplicantCategoryId = 1, - LoanTypeId = 1, - LoanPurposeId=1, - LoanCategoryId=2, - MinimumLoanAmount = 500000, - MaximumLoanAmount = 5000000, - InterestStartsFrom = 5.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 3, - ApplicantCategoryId = 1, - LoanTypeId = 1, - LoanPurposeId=2, - LoanCategoryId=1, - MinimumLoanAmount = 100000, - MaximumLoanAmount = 1000000, - InterestStartsFrom = 3.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 4, - ApplicantCategoryId = 1, - LoanTypeId = 1, - LoanPurposeId=2, - LoanCategoryId=2, - MinimumLoanAmount = 50000, - MaximumLoanAmount = 500000, - InterestStartsFrom = 3.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 5, - ApplicantCategoryId = 1, - LoanTypeId = 1, - LoanPurposeId=3, - LoanCategoryId=1, - MinimumLoanAmount = 50000, - MaximumLoanAmount = 200000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 6, - ApplicantCategoryId = 1, - LoanTypeId = 1, - LoanPurposeId=3, - LoanCategoryId=2, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 7, - ApplicantCategoryId = 2, - LoanTypeId = 2, - LoanPurposeId=4, - LoanCategoryId=3, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 8, - ApplicantCategoryId = 2, - LoanTypeId = 2, - LoanPurposeId=4, - LoanCategoryId=4, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 9, - ApplicantCategoryId = 2, - LoanTypeId = 2, - LoanPurposeId=4, - LoanCategoryId=5, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 10, - ApplicantCategoryId = 2, - LoanTypeId = 2, - LoanPurposeId=5, - LoanCategoryId=3, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 11, - ApplicantCategoryId = 2, - LoanTypeId = 2, - LoanPurposeId=5, - LoanCategoryId=4, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 12, - ApplicantCategoryId = 2, - LoanTypeId = 2, - LoanPurposeId=5, - LoanCategoryId=5, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 13, - ApplicantCategoryId = 2, - LoanTypeId = 3, - LoanPurposeId=6, - LoanCategoryId=6, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 14, - ApplicantCategoryId = 2, - LoanTypeId = 3, - LoanPurposeId=6, - LoanCategoryId=7, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 15, - ApplicantCategoryId = 2, - LoanTypeId = 3, - LoanPurposeId=7, - LoanCategoryId=7, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 16, - ApplicantCategoryId = 2, - LoanTypeId = 3, - LoanPurposeId=8, - LoanCategoryId=7, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 17, - ApplicantCategoryId = 2, - LoanTypeId = 4, - LoanPurposeId=9, - LoanCategoryId=8, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 18, - ApplicantCategoryId = 2, - LoanTypeId = 4, - LoanPurposeId=9, - LoanCategoryId=9, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 19, - ApplicantCategoryId = 2, - LoanTypeId = 4, - LoanPurposeId=9, - LoanCategoryId=10, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 20, - ApplicantCategoryId = 2, - LoanTypeId = 4, - LoanPurposeId=10, - LoanCategoryId=8, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 21, - ApplicantCategoryId = 2, - LoanTypeId = 4, - LoanPurposeId=10, - LoanCategoryId=9, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 22, - ApplicantCategoryId = 2, - LoanTypeId = 4, - LoanPurposeId=10, - LoanCategoryId=10, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 23, - ApplicantCategoryId = 3, - LoanTypeId = 2, - LoanPurposeId=4, - LoanCategoryId=3, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 24, - ApplicantCategoryId = 3, - LoanTypeId = 2, - LoanPurposeId=4, - LoanCategoryId=4, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 25, - ApplicantCategoryId = 3, - LoanTypeId = 2, - LoanPurposeId=4, - LoanCategoryId=5, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 26, - ApplicantCategoryId = 3, - LoanTypeId = 2, - LoanPurposeId=5, - LoanCategoryId=3, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 27, - ApplicantCategoryId = 3, - LoanTypeId = 2, - LoanPurposeId=5, - LoanCategoryId=4, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 28, - ApplicantCategoryId = 3, - LoanTypeId = 2, - LoanPurposeId=5, - LoanCategoryId=5, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - - new LoanEligibility - { - Id = 29, - ApplicantCategoryId = 3, - LoanTypeId = 4, - LoanPurposeId=9, - LoanCategoryId=8, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 30, - ApplicantCategoryId = 3, - LoanTypeId = 4, - LoanPurposeId=9, - LoanCategoryId=9, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 31, - ApplicantCategoryId = 3, - LoanTypeId = 4, - LoanPurposeId=9, - LoanCategoryId=10, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - - new LoanEligibility - { - Id = 32, - ApplicantCategoryId = 3, - LoanTypeId = 4, - LoanPurposeId=10, - LoanCategoryId=8, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 33, - ApplicantCategoryId = 3, - LoanTypeId = 4, - LoanPurposeId=10, - LoanCategoryId=9, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 34, - ApplicantCategoryId = 3, - LoanTypeId = 4, - LoanPurposeId=10, - LoanCategoryId=10, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - //entrepreneur - new LoanEligibility - { - Id = 35, - ApplicantCategoryId = 4, - LoanTypeId = 2, - LoanPurposeId=4, - LoanCategoryId=3, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m , - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 36, - ApplicantCategoryId = 4, - LoanTypeId = 2, - LoanPurposeId=4, - LoanCategoryId=4, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 37, - ApplicantCategoryId = 4, - LoanTypeId = 2, - LoanPurposeId=4, - LoanCategoryId=5, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 38, - ApplicantCategoryId = 4, - LoanTypeId = 2, - LoanPurposeId=5, - LoanCategoryId=3, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m , - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 39, - ApplicantCategoryId = 4, - LoanTypeId = 2, - LoanPurposeId=5, - LoanCategoryId=4, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m , - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 40, - ApplicantCategoryId = 4, - LoanTypeId = 2, - LoanPurposeId=5, - LoanCategoryId=5, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 41, - ApplicantCategoryId = 4, - LoanTypeId = 3, - LoanPurposeId=6, - LoanCategoryId=6, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m , - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 42, - ApplicantCategoryId = 4, - LoanTypeId = 3, - LoanPurposeId=6, - LoanCategoryId=7, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m , - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 43, - ApplicantCategoryId = 4, - LoanTypeId = 3, - LoanPurposeId=7, - LoanCategoryId=7, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m , - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 44, - ApplicantCategoryId = 4, - LoanTypeId = 3, - LoanPurposeId=8, - LoanCategoryId=7, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m, - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow , - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 45, - ApplicantCategoryId = 4, - LoanTypeId = 4, - LoanPurposeId=9, - LoanCategoryId=8, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m , - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 46, - ApplicantCategoryId = 4, - LoanTypeId = 4, - LoanPurposeId=9, - LoanCategoryId=9, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m , - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 47, - ApplicantCategoryId = 4, - LoanTypeId = 4, - LoanPurposeId=9, - LoanCategoryId=10, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m , - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 48, - ApplicantCategoryId = 4, - LoanTypeId = 4, - LoanPurposeId=10, - LoanCategoryId=8, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m , - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 49, - ApplicantCategoryId = 4, - LoanTypeId = 4, - LoanPurposeId=10, - LoanCategoryId=9, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m , - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - CreatedBy=1, - UpdatedBy=1 - }, - new LoanEligibility - { - Id = 50, - ApplicantCategoryId = 4, - LoanTypeId = 4, - LoanPurposeId=10, - LoanCategoryId=10, - MinimumLoanAmount = 10000, - MaximumLoanAmount = 100000, - InterestStartsFrom = 2.0m , - IsActive = true, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow - } - ); - } - } -} \ No newline at end of file + modelBuilder.Entity<LoanEligibility>(entity => + { + + entity.Property(e => e.MinimumLoanAmount) + .HasColumnType("decimal(18,2)"); + + entity.Property(e => e.MaximumLoanAmount) + .HasColumnType("decimal(18,2)"); + + entity.Property(e => e.InterestStartsFrom) + .HasColumnType("decimal(5,2)"); + }); + DocumentSeeder.Seed(modelBuilder); + LoanEligibilitySeeder.Seed(modelBuilder); + LoanPurposeSeeder.Seed(modelBuilder); + ApplicantCategorySeeder.Seed(modelBuilder); + LoanCategorySeeder.Seed(modelBuilder); + LoanTypeSeeder.Seed(modelBuilder); + RoleSeeder.Seed(modelBuilder); + StatusSeeder.Seed(modelBuilder); + } + } + } \ No newline at end of file diff --git a/LoanApplication.Db/Data/MasterData.cs/ApplicantCategorySeeder.cs b/LoanApplication.Db/Data/MasterData.cs/ApplicantCategorySeeder.cs new file mode 100644 index 0000000..924cb14 --- /dev/null +++ b/LoanApplication.Db/Data/MasterData.cs/ApplicantCategorySeeder.cs @@ -0,0 +1,39 @@ +using LoanApplication.Db.Entities; +using LoanApplication.Utilities.Enums; // Ensure this namespace contains your enum definition +using Microsoft.EntityFrameworkCore; + +namespace LoanApplication.Db.Seeds +{ + public static class ApplicantCategorySeeder + { + private static int applicantCategoryIdCounter = 1; + private static ApplicantCategory CreateApplicantCategory(ApplicantCategoryName categoryName, bool isActive, int createdBy, int updatedBy) + { + return new ApplicantCategory + { + Id = applicantCategoryIdCounter++, + ApplicantCategoryName = categoryName, + IsActive = isActive, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy = createdBy, + UpdatedBy = updatedBy + }; + } + public static void Seed(ModelBuilder modelBuilder) + { + var categories = new List<ApplicantCategoryName> + { + ApplicantCategoryName.Student, + ApplicantCategoryName.Employed, + ApplicantCategoryName.UnEmployed, + ApplicantCategoryName.Entrepreneur + }; + + foreach (var category in categories) + { + modelBuilder.Entity<ApplicantCategory>().HasData(CreateApplicantCategory(category, true, 1, 1)); + } + } + } +} \ No newline at end of file diff --git a/LoanApplication.Db/Data/MasterData.cs/DocumentSeeder.cs b/LoanApplication.Db/Data/MasterData.cs/DocumentSeeder.cs new file mode 100644 index 0000000..5b4721f --- /dev/null +++ b/LoanApplication.Db/Data/MasterData.cs/DocumentSeeder.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using LoanApplication.Db.Entities; +using LoanApplication.Utilities.Enums; // Include the namespace for your enum +using Microsoft.EntityFrameworkCore; + +namespace LoanApplication.Db.Seeds +{ + public static class DocumentSeeder + { + private static int documentIdCounter = 1; + + private static Document CreateDocument(DocumentName documentName, bool isActive, int createdBy, int updatedBy) + { + return new Document + { + Id = documentIdCounter++, // Increment the counter for each new document + DocumentName = documentName, // Set the document name from the enum + IsActive = isActive, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy = createdBy, + UpdatedBy = updatedBy + }; + } + + public static void Seed(ModelBuilder modelBuilder) + { + var documents = new List<DocumentName> + { + DocumentName.PanCard, + DocumentName.AadharCard, + DocumentName.PassportSizePhoto, + DocumentName.Last6MonthsBankStatement, + DocumentName.EducationMemos, + DocumentName.AdmissionLetter, + DocumentName.MeritScore, + DocumentName.GuardianIncomeProof, + DocumentName.PaySlip, + DocumentName.IncomeProof, + DocumentName.PlotAddress, + DocumentName.OwnerDocument, + DocumentName.DrivingLicense, + DocumentName.VehicleInsurence + }; + + foreach (var documentName in documents) + { + modelBuilder.Entity<Document>().HasData(CreateDocument(documentName, true, 1, 1)); + } + } + } +} \ No newline at end of file diff --git a/LoanApplication.Db/Data/MasterData.cs/LoanCategorySeeder.cs b/LoanApplication.Db/Data/MasterData.cs/LoanCategorySeeder.cs new file mode 100644 index 0000000..b5ddf09 --- /dev/null +++ b/LoanApplication.Db/Data/MasterData.cs/LoanCategorySeeder.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using LoanApplication.Db.Entities; +using LoanApplication.Utilities.Enums; // Include the namespace for your enum +using Microsoft.EntityFrameworkCore; + +namespace LoanApplication.Db.Seeds +{ + public static class LoanCategorySeeder + { + private static int loanCategoryIdCounter = 1; + + private static LoanCategory CreateLoanCategory(LoanCategoryName loanCategoryName, int loanTypeId, bool isActive, int createdBy, int updatedBy) + { + return new LoanCategory + { + Id = loanCategoryIdCounter++, + LoanCategoryName = loanCategoryName, + LoanTypeId = loanTypeId, + IsActive = isActive, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy = createdBy, + UpdatedBy = updatedBy + }; + } + + public static void Seed(ModelBuilder modelBuilder) + { + var loanCategories = new List<(LoanCategoryName Name, int LoanTypeId)> + { + (LoanCategoryName.Merit, 1), + (LoanCategoryName.Demerit, 1), + (LoanCategoryName.Gold18k, 2), + (LoanCategoryName.Gold22k, 2), + (LoanCategoryName.Gold24k, 2), + (LoanCategoryName.WithPlot, 3), + (LoanCategoryName.WithoutPlot, 3), + (LoanCategoryName.TwoWheeler, 4), + (LoanCategoryName.ThreeWheeler, 4), + (LoanCategoryName.FourWheeler, 4) + }; + + foreach (var (name, loanTypeId) in loanCategories) + { + modelBuilder.Entity<LoanCategory>().HasData(CreateLoanCategory(name, loanTypeId, true, 1, 1)); + } + } + } +} \ No newline at end of file diff --git a/LoanApplication.Db/Data/MasterData.cs/LoanEligibilitySeeder.cs b/LoanApplication.Db/Data/MasterData.cs/LoanEligibilitySeeder.cs new file mode 100644 index 0000000..13c2f05 --- /dev/null +++ b/LoanApplication.Db/Data/MasterData.cs/LoanEligibilitySeeder.cs @@ -0,0 +1,95 @@ +using LoanApplication.Db.Entities; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; + +namespace LoanApplication.Db.Seeds +{ + public static class LoanEligibilitySeeder + { + private static int loanEligibilityIdCounter = 1; + + private static LoanEligibility CreateLoanEligibility(int applicantCategoryId, int loanTypeId, int loanPurposeId, int loanCategoryId, decimal minimumLoanAmount, decimal maximumLoanAmount, decimal interestStartsFrom, bool isActive, int createdBy, int updatedBy) + { + return new LoanEligibility + { + Id = loanEligibilityIdCounter++, + ApplicantCategoryId = applicantCategoryId, + LoanTypeId = loanTypeId, + LoanPurposeId = loanPurposeId, + LoanCategoryId = loanCategoryId, + MinimumLoanAmount = minimumLoanAmount, + MaximumLoanAmount = maximumLoanAmount, + InterestStartsFrom = interestStartsFrom, + IsActive = isActive, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy = createdBy, + UpdatedBy = updatedBy + }; + } + + public static void Seed(ModelBuilder modelBuilder) + { + var loanEligibilities = new List<(int ApplicantCategoryId, int LoanTypeId, int LoanPurposeId, int LoanCategoryId, decimal MinimumLoanAmount, decimal MaximumLoanAmount, decimal InterestStartsFrom)> + { + (1, 1, 1, 1, 1000000, 7000000, 4.5m), + (1, 1, 1, 2, 300000, 6000000, 3.8m), + (1, 1, 2, 1, 150000, 1200000, 3.5m), + (1, 1, 2, 2, 30000, 800000, 4.2m), + (1, 1, 3, 1, 70000, 250000, 4.0m), + (1, 1, 3, 2, 15000, 150000, 11.0m), + (2, 2, 4, 3, 5000, 150000, 9.5m), + (2, 2, 4, 4, 12000, 90000, 2.5m), + (2, 2, 4, 5, 20000, 95000, 3.0m), + (2, 2, 5, 3, 11000, 100000, 2.0m), + (2, 2, 5, 4, 5000, 120000, 2.8m), + (2, 2, 5, 5, 15000, 70000, 2.6m), + (2, 3, 6, 6, 4000, 80000, 2.1m), + (2, 3, 6, 7, 8000, 85000, 2.3m), + (2, 3, 7, 7, 9000, 95000, 2.4m), + (2, 3, 8, 7, 8000, 90000, 2.7m), + (2, 4, 9, 8, 5000, 75000, 3.1m), + (2, 4, 9, 9, 7000, 85000, 2.9m), + (2, 4, 9, 10, 15000, 80000, 3.3m), + (2, 4, 10, 8, 6000, 70000, 3.4m), + (2, 4, 10, 9, 4000, 90000, 2.8m), + (2, 4, 10, 10, 8000, 85000, 2.2m), + (3, 2, 4, 3, 20000, 95000, 2.0m), + (3, 2, 4, 4, 15000, 85000, 2.1m), + (3, 2, 4, 5, 10000, 90000, 2.0m), + (3, 2, 5, 3, 5000, 76000, 2.4m), + (3, 2, 5, 4, 20000, 110000, 2.5m), + (3, 2, 5, 5, 3000, 70000, 2.3m), + (3, 4, 9, 8, 15000, 100000, 2.9m), + (3, 4, 9, 9, 9000, 95000, 3.0m), + (3, 4, 9, 10, 8000, 80000, 2.6m), + (3, 4, 10, 8, 8000, 90000, 2.8m), + (3, 4, 10, 9, 7000, 85000, 2.7m), + (3, 4, 10, 10, 12000, 76000, 3.0m), + (4, 2, 4, 3, 5000, 95000, 3.5m), + (4, 2, 4, 4, 6000, 85000, 3.4m), + (4, 2, 4, 5, 7000, 90000, 2.8m), + (4, 2, 5, 3, 3000, 95000, 2.2m), + (4, 2, 5, 4, 11000, 60000, 2.1m), + (4, 2, 5, 5, 8000, 95000, 2.0m), + (4, 3, 6, 6, 8000, 80000, 2.5m), + (4, 3, 6, 7, 10000, 95000, 2.9m), + (4, 3, 7, 7, 12000, 90000, 2.8m), + (4, 3, 8, 7, 13000, 82000, 2.6m), + (4, 4, 9, 8, 12000, 78000, 3.0m), + (4, 4, 9, 9, 10000, 95000, 2.9m), + (4, 4, 9, 10, 7000, 72000, 2.7m), + (4, 4, 10, 8, 6000, 82000, 3.3m), + (4, 4, 10, 9, 5000, 85000, 3.4m), + (4, 4, 10, 10, 7000, 90000, 3.1m) + }; + + foreach (var (applicantCategoryId, loanTypeId, loanPurposeId, loanCategoryId, minimumLoanAmount, maximumLoanAmount, interestStartsFrom) in loanEligibilities) + { + modelBuilder.Entity<LoanEligibility>().HasData(CreateLoanEligibility(applicantCategoryId, loanTypeId, loanPurposeId, loanCategoryId, minimumLoanAmount, maximumLoanAmount, interestStartsFrom, true, 1, 1)); + } + } + } +} + \ No newline at end of file diff --git a/LoanApplication.Db/Data/MasterData.cs/LoanPurposeSeeder.cs b/LoanApplication.Db/Data/MasterData.cs/LoanPurposeSeeder.cs new file mode 100644 index 0000000..37c6b54 --- /dev/null +++ b/LoanApplication.Db/Data/MasterData.cs/LoanPurposeSeeder.cs @@ -0,0 +1,47 @@ + +using LoanApplication.Db.Entities; +using LoanApplication.Utilities.Enums; +using Microsoft.EntityFrameworkCore; + +namespace LoanApplication.Db.Seeds +{ + public static class LoanPurposeSeeder + { + private static int loanPurposeIdCounter = 1; + private static LoanPurpose CreateLoanPurpose(LoanPurposeName loanPurposeName, int loanTypeId, bool isActive, int createdBy, int updatedBy) + { + return new LoanPurpose + { + Id = loanPurposeIdCounter++, + LoanPurposeName = loanPurposeName, + LoanTypeId = loanTypeId, + IsActive = isActive, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy = createdBy, + UpdatedBy = updatedBy + }; + } + public static void Seed(ModelBuilder modelBuilder) + { + var loanPurposes = new List<(LoanPurposeName Name, int LoanTypeId)> + { + (LoanPurposeName.Abroad, 1), + (LoanPurposeName.PostGraduation, 1), + (LoanPurposeName.UnderGraduation, 1), + (LoanPurposeName.ChildrenEducation, 2), + (LoanPurposeName.GoldLoanForBusiness, 2), + (LoanPurposeName.Build, 3), + (LoanPurposeName.Buy, 3), + (LoanPurposeName.Renovation, 3), + (LoanPurposeName.VehicleLoanForBusiness, 4), + (LoanPurposeName.PersonalUsage, 4) + }; + + foreach (var (name, loanTypeId) in loanPurposes) + { + modelBuilder.Entity<LoanPurpose>().HasData(CreateLoanPurpose(name, loanTypeId, true, 1, 1)); + } + } + } +} \ No newline at end of file diff --git a/LoanApplication.Db/Data/MasterData.cs/LoanTypeSeeder.cs b/LoanApplication.Db/Data/MasterData.cs/LoanTypeSeeder.cs new file mode 100644 index 0000000..baf5ca6 --- /dev/null +++ b/LoanApplication.Db/Data/MasterData.cs/LoanTypeSeeder.cs @@ -0,0 +1,39 @@ +using LoanApplication.Db.Entities; +using LoanApplication.Utilities.Enums; +using Microsoft.EntityFrameworkCore; + +namespace LoanApplication.Db.Seeds +{ + public static class LoanTypeSeeder + { + private static int loanTypeIdCounter = 1; + private static LoanType CreateLoanType(LoanTypeName loanTypeName, bool isActive, int createdBy, int updatedBy) + { + return new LoanType + { + Id = loanTypeIdCounter++, + LoanTypeName = loanTypeName, + IsActive = isActive, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy = createdBy, + UpdatedBy = updatedBy + }; + } + public static void Seed(ModelBuilder modelBuilder) + { + var loanTypes = new List<LoanTypeName> + { + LoanTypeName.Education, + LoanTypeName.Gold, + LoanTypeName.Home, + LoanTypeName.Vehicle + }; + + foreach (var loanType in loanTypes) + { + modelBuilder.Entity<LoanType>().HasData(CreateLoanType(loanType, true, 1, 1)); + } + } + } +} \ No newline at end of file diff --git a/LoanApplication.Db/Data/MasterData.cs/RoleSeeder.cs b/LoanApplication.Db/Data/MasterData.cs/RoleSeeder.cs new file mode 100644 index 0000000..de8513f --- /dev/null +++ b/LoanApplication.Db/Data/MasterData.cs/RoleSeeder.cs @@ -0,0 +1,37 @@ +using LoanApplication.Db.Entities; +using LoanApplication.Utilities.Enums; +using Microsoft.EntityFrameworkCore; + +namespace LoanApplication.Db.Seeds +{ + public static class RoleSeeder + { + private static int roleIdCounter = 1; + private static Role CreateRole(RoleName roleName, bool isActive, int createdBy, int updatedBy) + { + return new Role + { + Id = roleIdCounter++, + RoleName = roleName, + IsActive = isActive, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy = createdBy, + UpdatedBy = updatedBy + }; + } + public static void Seed(ModelBuilder modelBuilder) + { + var roles = new List<RoleName> + { + RoleName.SuperAdmin, + RoleName.Admin, + RoleName.User + }; + foreach (var role in roles) + { + modelBuilder.Entity<Role>().HasData(CreateRole(role, true, 1, 1)); + } + } + } +} \ No newline at end of file diff --git a/LoanApplication.Db/Data/MasterData.cs/StatusSeeder.cs b/LoanApplication.Db/Data/MasterData.cs/StatusSeeder.cs new file mode 100644 index 0000000..e3ff8b7 --- /dev/null +++ b/LoanApplication.Db/Data/MasterData.cs/StatusSeeder.cs @@ -0,0 +1,40 @@ + +using LoanApplication.Db.Entities; +using LoanApplication.Utilities.Enums; +using Microsoft.EntityFrameworkCore; + +namespace LoanApplication.Db.Seeds +{ + public static class StatusSeeder + { + private static int statusIdCounter = 1; + private static Status CreateStatus(StatusName statusName, bool isActive, int createdBy, int updatedBy) + { + return new Status + { + Id = statusIdCounter++, + StatusName = statusName, + IsActive = isActive, + CreatedAt = DateTime.UtcNow, + ModifiedAt = DateTime.UtcNow, + CreatedBy = createdBy, + UpdatedBy = updatedBy + }; + } + public static void Seed(ModelBuilder modelBuilder) + { + var statuses = new List<StatusName> + { + StatusName.New, + StatusName.Pending, + StatusName.Approved, + StatusName.Rejected + }; + + foreach (var status in statuses) + { + modelBuilder.Entity<Status>().HasData(CreateStatus(status, true, 1, 1)); + } + } + } +} \ No newline at end of file diff --git a/LoanApplication.Db/Entities/Applicant.cs b/LoanApplication.Db/Entities/Applicant.cs index 9734209..10ea1bf 100644 --- a/LoanApplication.Db/Entities/Applicant.cs +++ b/LoanApplication.Db/Entities/Applicant.cs @@ -6,6 +6,15 @@ namespace LoanApplication.Db.Entities; public class Applicant { + /// <summary> + /// Has many to one relation with user + /// has one to one relation with applicantcategory + /// has many to one relation with applicationstatus + /// has many to one relation with loantype + /// has many to one relation with loancategory + /// has many to one relation with loanpurpose + /// has one to many relation with documentdetails + /// </summary> public int Id { get; set; } public string FirstName { get; set; } public string LastName { get; set; } @@ -17,19 +26,19 @@ public class Applicant public bool IsActive { get; set; } public DateTime CreatedAt { get; set; } public DateTime ModifiedAt { get; set; } - public User User { get; set; } public int UserId { get; set; } - public ApplicantCategory ApplicantCategory { get; set; } public int ApplicantCategoryId { get; set; } - public Status ApplicationStatus { get; set; } public int StatusId { get; set; } - public LoanType LoanType { get; set; } public int LoanTypeId { get; set; } - public LoanPurpose LoanPurpose { get; set; } public int LoanPurposeId { get; set; } - public LoanCategory LoanCategory { get; set; } public int LoanCategoryId { get; set; } - public List<DocumentDetails> DocumentDetails { get; set; } - public int? VerifiedBy{get;set;} + public int? VerifiedBy { get; set; } + public User User { get; set; } + public ApplicantCategory ApplicantCategory { get; set; } + public Status ApplicationStatus { get; set; } + public LoanType LoanType { get; set; } + public LoanPurpose LoanPurpose { get; set; } + public LoanCategory LoanCategory { get; set; } + public List<DocumentDetails> DocumentDetails { get; set; } } diff --git a/LoanApplication.Db/Entities/ApplicantCategory.cs b/LoanApplication.Db/Entities/ApplicantCategory.cs index 782da41..a2cba68 100644 --- a/LoanApplication.Db/Entities/ApplicantCategory.cs +++ b/LoanApplication.Db/Entities/ApplicantCategory.cs @@ -6,16 +6,18 @@ namespace LoanApplication.Db.Entities; public class ApplicantCategory { - public int Id{get;set;} + /// <summary> + /// has one to many relation with applicants + /// has one many relation with loaneligibilities + /// </summary> + public int Id { get; set; } [JsonConverter(typeof(JsonStringEnumConverter))] - public ApplicantCategoryName ApplicantCategoryName{get;set;} - public List<Applicant> Applicants{get;set;} - public List<LoanEligibility> LoanEligibilities{get;set;} - public bool IsActive{get;set;} - public DateTime CreatedAt{get;set;} - public DateTime ModifiedAt{get;set;} - - //admin details - public int CreatedBy{get;set;} - public int UpdatedBy{get;set;} + public ApplicantCategoryName ApplicantCategoryName { get; set; } + public bool IsActive { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime ModifiedAt { get; set; } + public int CreatedBy { get; set; } + public int UpdatedBy { get; set; } + public List<Applicant> Applicants { get; set; } + public List<LoanEligibility> LoanEligibilities { get; set; } } diff --git a/LoanApplication.Db/Entities/Document.cs b/LoanApplication.Db/Entities/Document.cs index 3839261..d4f7341 100644 --- a/LoanApplication.Db/Entities/Document.cs +++ b/LoanApplication.Db/Entities/Document.cs @@ -6,16 +6,19 @@ namespace LoanApplication.Db.Entities; public class Document { - public int Id{get;set;} + /// <summary> + /// has many to many relation with loantypes + /// has one to many relation with documentdetails + /// </summary> + public int Id { get; set; } [JsonConverter(typeof(JsonStringEnumConverter))] - public DocumentName DocumentName{get;set;} - public List<LoanType> LoanTypes{get;set;} - - public List<DocumentDetails> DocumentDetails{get;set;} - public bool IsActive{get;set;} - public DateTime CreatedAt{get;set;} - public DateTime ModifiedAt{get;set;} - public int CreatedBy{get;set;} - public int UpdatedBy{get;set;} + public DocumentName DocumentName { get; set; } + public bool IsActive { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime ModifiedAt { get; set; } + public int CreatedBy { get; set; } + public int UpdatedBy { get; set; } + public List<LoanType> LoanTypes { get; set; } + public List<DocumentDetails> DocumentDetails { get; set; } } diff --git a/LoanApplication.Db/Entities/DocumentDetails.cs b/LoanApplication.Db/Entities/DocumentDetails.cs index 3736011..6ec3ae0 100644 --- a/LoanApplication.Db/Entities/DocumentDetails.cs +++ b/LoanApplication.Db/Entities/DocumentDetails.cs @@ -5,19 +5,21 @@ namespace LoanApplication.Db.Entities; public class DocumentDetails { - public int Id{get;set;} - public byte[] File{get;set;} - public string Comment{get;set;} - public Status DocumentVerificationStatus{get;set;} - public int StatusId{get;set;} - - public Applicant Applicant{get;set;} - public int ApplicantId{get;set;} - - public Document Document{get;set;} - public int DocumentId{get;set;} - public bool IsActive{get;set;} - public DateTime CreatedAt{get;set;} - public DateTime ModifiedAt{get;set;} - public int VerifiedBy{get;set;} + /// <summary> + /// has many to one relation with applicant + /// has many to one relation with document + /// </summary> + public int Id { get; set; } + public byte[] File { get; set; } + public string Comment { get; set; } + public int StatusId { get; set; } + public int ApplicantId { get; set; } + public int DocumentId { get; set; } + public bool IsActive { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime ModifiedAt { get; set; } + public int VerifiedBy { get; set; } + public Status DocumentVerificationStatus { get; set; } + public Applicant Applicant { get; set; } + public Document Document { get; set; } } diff --git a/LoanApplication.Db/Entities/LoanCategory.cs b/LoanApplication.Db/Entities/LoanCategory.cs index f0dccfd..f6b50b2 100644 --- a/LoanApplication.Db/Entities/LoanCategory.cs +++ b/LoanApplication.Db/Entities/LoanCategory.cs @@ -1,24 +1,23 @@ -using System; using System.Text.Json.Serialization; using LoanApplication.Utilities.Enums; - namespace LoanApplication.Db.Entities; - public class LoanCategory { - public int Id{get;set;} + /// <summary> + /// has one to many relation with loaneligibilities + /// has one to many relation with applicants + /// </summary> + public int Id { get; set; } [JsonConverter(typeof(JsonStringEnumConverter))] - public LoanCategoryName LoanCategoryName{get;set;} - public int LoanTypeId{get;set;} - - public LoanType LoanType{get;set;} - public List<LoanEligibility> LoanEligibilities{get;set;} + public int LoanTypeId { get; set; } + public bool IsActive { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime ModifiedAt { get; set; } + public int CreatedBy { get; set; } + public int UpdatedBy { get; set; } + public LoanCategoryName LoanCategoryName { get; set; } + public LoanType LoanType { get; set; } + public List<LoanEligibility> LoanEligibilities { get; set; } + public List<Applicant> Applicants { get; set; } - public List<Applicant> Applicants{get;set;} - public bool IsActive{get;set;} - public DateTime CreatedAt{get;set;} - public DateTime ModifiedAt{get;set;} - //admin details - public int CreatedBy{get;set;} - public int UpdatedBy{get;set;} } diff --git a/LoanApplication.Db/Entities/LoanEligibility.cs b/LoanApplication.Db/Entities/LoanEligibility.cs index 3575ce0..d904f9e 100644 --- a/LoanApplication.Db/Entities/LoanEligibility.cs +++ b/LoanApplication.Db/Entities/LoanEligibility.cs @@ -1,11 +1,12 @@ -using System; -using System.Data; -using System.Text.Json.Serialization; - namespace LoanApplication.Db.Entities; - public class LoanEligibility { + /// <summary> + /// many to one relation with applicantcategory + /// many to one relation with loantype + /// many to one relation with loanpurpose + /// many to one relation with loancategory + /// </summary> public int Id{get;set;} public decimal MinimumLoanAmount { get; set; } public decimal MaximumLoanAmount { get; set; } @@ -14,18 +15,14 @@ public class LoanEligibility public DateTime CreatedAt{get;set;} public DateTime ModifiedAt{get;set;} public int ApplicantCategoryId{get;set;} - - public ApplicantCategory ApplicantCategory{get;set;} public int LoanTypeId{get;set;} - - public LoanType LoanType{get;set;} public int LoanPurposeId{get;set;} - public LoanPurpose LoanPurpose{get;set;} public int LoanCategoryId{get;set;} - - public LoanCategory LoanCategory{get;set;} - //admin details public int CreatedBy{get;set;} public int UpdatedBy{get;set;} + public ApplicantCategory ApplicantCategory{get;set;} + public LoanType LoanType{get;set;} + public LoanPurpose LoanPurpose{get;set;} + public LoanCategory LoanCategory{get;set;} } diff --git a/LoanApplication.Db/Entities/LoanPurpose.cs b/LoanApplication.Db/Entities/LoanPurpose.cs index fac0d5c..752d394 100644 --- a/LoanApplication.Db/Entities/LoanPurpose.cs +++ b/LoanApplication.Db/Entities/LoanPurpose.cs @@ -1,26 +1,22 @@ -using System; using System.Text.Json.Serialization; using LoanApplication.Utilities.Enums; - namespace LoanApplication.Db.Entities; - public class LoanPurpose { - public int Id{get;set;} + /// <summary> + /// one to many relation with loaneligibilities + /// one to many relation with applicants + /// </summary> + public int Id { get; set; } + public int LoanTypeId { get; set; } [JsonConverter(typeof(JsonStringEnumConverter))] - public LoanPurposeName LoanPurposeName{get;set;} - - public int LoanTypeId{get;set;} - - public LoanType LoanType{get;set;} - - public List<LoanEligibility> LoanEligibilities{get;set;} - - public List<Applicant> Applicants{get;set;} - public bool IsActive{get;set;} - public DateTime CreatedAt{get;set;} - public DateTime ModifiedAt{get;set;} - //admin details - public int CreatedBy{get;set;} - public int UpdatedBy{get;set;} + public LoanPurposeName LoanPurposeName { get; set; } + public bool IsActive { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime ModifiedAt { get; set; } + public int CreatedBy { get; set; } + public int UpdatedBy { get; set; } + public LoanType LoanType { get; set; } + public List<LoanEligibility> LoanEligibilities { get; set; } + public List<Applicant> Applicants { get; set; } } diff --git a/LoanApplication.Db/Entities/LoanType.cs b/LoanApplication.Db/Entities/LoanType.cs index 302d382..ea80736 100644 --- a/LoanApplication.Db/Entities/LoanType.cs +++ b/LoanApplication.Db/Entities/LoanType.cs @@ -6,24 +6,24 @@ namespace LoanApplication.Db.Entities; public class LoanType { - public int Id{get;set;} + /// <summary> + /// has one to many relation with applicants + /// has many to many relation with documents + /// has one to many relation with loanpurposes + /// has one to many relation with loancategories + /// </summary> + public int Id { get; set; } [JsonConverter(typeof(JsonStringEnumConverter))] - public LoanTypeName LoanTypeName{get;set;} - - public List<Applicant> Applicants{get;set;} + public LoanTypeName LoanTypeName { get; set; } + public bool IsActive { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime ModifiedAt { get; set; } + public int CreatedBy { get; set; } + public int UpdatedBy { get; set; } + public List<Applicant> Applicants { get; set; } + public List<Document> Documents { get; set; } + public List<LoanEligibility> LoanEligibilities { get; set; } + public List<LoanPurpose> LoanPurposes { get; set; } + public List<LoanCategory> LoanCategories { get; set; } - public List<Document> Documents{get;set;} - - public List<LoanEligibility> LoanEligibilities{get;set;} - - public List<LoanPurpose> LoanPurposes{get;set;} - - public List<LoanCategory> LoanCategories{get;set;} - public bool IsActive{get;set;} - public DateTime CreatedAt{get;set;} - public DateTime ModifiedAt{get;set;} - //admin details - public int CreatedBy{get;set;} - public int UpdatedBy{get;set;} - } diff --git a/LoanApplication.Db/Entities/Role.cs b/LoanApplication.Db/Entities/Role.cs index dd33d10..c66a550 100644 --- a/LoanApplication.Db/Entities/Role.cs +++ b/LoanApplication.Db/Entities/Role.cs @@ -6,15 +6,17 @@ namespace LoanApplication.Db.Entities; public class Role { - public int Id{get;set;} + /// <summary> + /// has one to many relation with users + /// </summary> + public int Id { get; set; } [JsonConverter(typeof(JsonStringEnumConverter))] - public RoleName RoleName{get;set;} + public RoleName RoleName { get; set; } + public bool IsActive { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime ModifiedAt { get; set; } + public int CreatedBy { get; set; } + public int UpdatedBy { get; set; } [JsonIgnore] - public List<User> Users{get;set;} - public bool IsActive{get;set;} - public DateTime CreatedAt{get;set;} - public DateTime ModifiedAt{get;set;} - //admin details - public int CreatedBy{get;set;} - public int UpdatedBy{get;set;} + public List<User> Users { get; set; } } diff --git a/LoanApplication.Db/Entities/Status.cs b/LoanApplication.Db/Entities/Status.cs index edd9867..9754f69 100644 --- a/LoanApplication.Db/Entities/Status.cs +++ b/LoanApplication.Db/Entities/Status.cs @@ -6,17 +6,19 @@ namespace LoanApplication.Db.Entities; public class Status { - public int Id{get;set;} + /// <summary> + /// has one to many relation with documentdetails + /// has one to many relation with applicants + /// </summary> + public int Id { get; set; } [JsonConverter(typeof(JsonStringEnumConverter))] - public StatusName StatusName{get;set;} - - public List<Applicant> Applicants{get;set;} + public StatusName StatusName { get; set; } + public bool IsActive { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime ModifiedAt { get; set; } + public int CreatedBy { get; set; } + public int UpdatedBy { get; set; } + public List<DocumentDetails> DocumentDetails { get; set; } + public List<Applicant> Applicants { get; set; } - public List<DocumentDetails> DocumentDetails{get;set;} - public bool IsActive{get;set;} - public DateTime CreatedAt{get;set;} - public DateTime ModifiedAt{get;set;} - //admin details - public int CreatedBy{get;set;} - public int UpdatedBy{get;set;} } diff --git a/LoanApplication.Db/Entities/User.cs b/LoanApplication.Db/Entities/User.cs index b6d997a..fb1a801 100644 --- a/LoanApplication.Db/Entities/User.cs +++ b/LoanApplication.Db/Entities/User.cs @@ -1,24 +1,27 @@ using System; using System.Text.Json.Serialization; -namespace LoanApplication.Db.Entities -{ - public class User - { - public int Id { get; set; } - public string UserName { get; set; } - public string Email { get; set; } - public string Password { get; set; } - public int RoleId { get; set; } - public Role Role { get; set; } - +namespace LoanApplication.Db.Entities +{ + public class User + { + /// <summary> + /// has many to one relation with role + /// has one to many relation with applicants + /// </summary> + public int Id { get; set; } + public string UserName { get; set; } + public string Email { get; set; } + public string Password { get; set; } + public int RoleId { get; set; } + public bool IsActive { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime ModifiedAt { get; set; } + public string PasswordResetToken { get; set; } + public DateTime? TokenExpiration { get; set; } + public Role Role { get; set; } [JsonIgnore] - public List<Applicant> Applicants { get; set; } - public bool IsActive { get; set; } - public DateTime CreatedAt { get; set; } - public DateTime ModifiedAt { get; set; } - public string PasswordResetToken { get; set; } - public DateTime? TokenExpiration { get; set; } - - } + public List<Applicant> Applicants { get; set; } + + } } \ No newline at end of file -- GitLab From 90395c3f69a5a183314a90d035f37262083cf468 Mon Sep 17 00:00:00 2001 From: srujitha <srujitha.vutla@pal.tech> Date: Thu, 28 Nov 2024 22:15:05 +0530 Subject: [PATCH 3/4] Updated DbSchema --- LoanApplication.Db/Data/DataContext.cs | 4 ++-- .../Data/MasterData.cs/ApplicantCategorySeeder.cs | 2 +- LoanApplication.Db/Data/MasterData.cs/DocumentSeeder.cs | 6 +++--- LoanApplication.Db/Data/MasterData.cs/LoanCategorySeeder.cs | 2 +- .../Data/MasterData.cs/LoanEligibilitySeeder.cs | 2 -- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/LoanApplication.Db/Data/DataContext.cs b/LoanApplication.Db/Data/DataContext.cs index eddc358..0a6c404 100644 --- a/LoanApplication.Db/Data/DataContext.cs +++ b/LoanApplication.Db/Data/DataContext.cs @@ -177,13 +177,13 @@ namespace LoanApplication.Db .HasMany(lc => lc.LoanEligibilities) .WithOne(le => le.LoanCategory) .HasForeignKey(le => le.LoanCategoryId) - .OnDelete(DeleteBehavior.Restrict); // Prevent cascading delete + .OnDelete(DeleteBehavior.Restrict); modelBuilder.Entity<LoanPurpose>() .HasMany(lp => lp.LoanEligibilities) .WithOne(le => le.LoanPurpose) .HasForeignKey(le => le.LoanPurposeId) - .OnDelete(DeleteBehavior.Restrict); // Prevent cascading delete + .OnDelete(DeleteBehavior.Restrict); modelBuilder.Entity<LoanEligibility>(entity => { diff --git a/LoanApplication.Db/Data/MasterData.cs/ApplicantCategorySeeder.cs b/LoanApplication.Db/Data/MasterData.cs/ApplicantCategorySeeder.cs index 924cb14..3bbb40b 100644 --- a/LoanApplication.Db/Data/MasterData.cs/ApplicantCategorySeeder.cs +++ b/LoanApplication.Db/Data/MasterData.cs/ApplicantCategorySeeder.cs @@ -1,5 +1,5 @@ using LoanApplication.Db.Entities; -using LoanApplication.Utilities.Enums; // Ensure this namespace contains your enum definition +using LoanApplication.Utilities.Enums; using Microsoft.EntityFrameworkCore; namespace LoanApplication.Db.Seeds diff --git a/LoanApplication.Db/Data/MasterData.cs/DocumentSeeder.cs b/LoanApplication.Db/Data/MasterData.cs/DocumentSeeder.cs index 5b4721f..35845f3 100644 --- a/LoanApplication.Db/Data/MasterData.cs/DocumentSeeder.cs +++ b/LoanApplication.Db/Data/MasterData.cs/DocumentSeeder.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using LoanApplication.Db.Entities; -using LoanApplication.Utilities.Enums; // Include the namespace for your enum +using LoanApplication.Utilities.Enums; using Microsoft.EntityFrameworkCore; namespace LoanApplication.Db.Seeds @@ -14,8 +14,8 @@ namespace LoanApplication.Db.Seeds { return new Document { - Id = documentIdCounter++, // Increment the counter for each new document - DocumentName = documentName, // Set the document name from the enum + Id = documentIdCounter++, + DocumentName = documentName, IsActive = isActive, CreatedAt = DateTime.UtcNow, ModifiedAt = DateTime.UtcNow, diff --git a/LoanApplication.Db/Data/MasterData.cs/LoanCategorySeeder.cs b/LoanApplication.Db/Data/MasterData.cs/LoanCategorySeeder.cs index b5ddf09..7d5a3eb 100644 --- a/LoanApplication.Db/Data/MasterData.cs/LoanCategorySeeder.cs +++ b/LoanApplication.Db/Data/MasterData.cs/LoanCategorySeeder.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using LoanApplication.Db.Entities; -using LoanApplication.Utilities.Enums; // Include the namespace for your enum +using LoanApplication.Utilities.Enums; using Microsoft.EntityFrameworkCore; namespace LoanApplication.Db.Seeds diff --git a/LoanApplication.Db/Data/MasterData.cs/LoanEligibilitySeeder.cs b/LoanApplication.Db/Data/MasterData.cs/LoanEligibilitySeeder.cs index 13c2f05..255d30f 100644 --- a/LoanApplication.Db/Data/MasterData.cs/LoanEligibilitySeeder.cs +++ b/LoanApplication.Db/Data/MasterData.cs/LoanEligibilitySeeder.cs @@ -1,7 +1,5 @@ using LoanApplication.Db.Entities; using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; namespace LoanApplication.Db.Seeds { -- GitLab From a5ea3660ad39d83a3f287acb244b755c0c8d15ec Mon Sep 17 00:00:00 2001 From: Srujitha Vutla <srujitha.vutla@pal.tech> Date: Fri, 29 Nov 2024 18:40:42 +0000 Subject: [PATCH 4/4] Updated DbSchema --- .../Data/{MasterData.cs => MasterData}/ApplicantCategorySeeder.cs | 0 .../Data/{MasterData.cs => MasterData}/DocumentSeeder.cs | 0 .../Data/{MasterData.cs => MasterData}/LoanCategorySeeder.cs | 0 .../Data/{MasterData.cs => MasterData}/LoanEligibilitySeeder.cs | 0 .../Data/{MasterData.cs => MasterData}/LoanPurposeSeeder.cs | 0 .../Data/{MasterData.cs => MasterData}/LoanTypeSeeder.cs | 0 .../Data/{MasterData.cs => MasterData}/RoleSeeder.cs | 0 .../Data/{MasterData.cs => MasterData}/StatusSeeder.cs | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename LoanApplication.Db/Data/{MasterData.cs => MasterData}/ApplicantCategorySeeder.cs (100%) rename LoanApplication.Db/Data/{MasterData.cs => MasterData}/DocumentSeeder.cs (100%) rename LoanApplication.Db/Data/{MasterData.cs => MasterData}/LoanCategorySeeder.cs (100%) rename LoanApplication.Db/Data/{MasterData.cs => MasterData}/LoanEligibilitySeeder.cs (100%) rename LoanApplication.Db/Data/{MasterData.cs => MasterData}/LoanPurposeSeeder.cs (100%) rename LoanApplication.Db/Data/{MasterData.cs => MasterData}/LoanTypeSeeder.cs (100%) rename LoanApplication.Db/Data/{MasterData.cs => MasterData}/RoleSeeder.cs (100%) rename LoanApplication.Db/Data/{MasterData.cs => MasterData}/StatusSeeder.cs (100%) diff --git a/LoanApplication.Db/Data/MasterData.cs/ApplicantCategorySeeder.cs b/LoanApplication.Db/Data/MasterData/ApplicantCategorySeeder.cs similarity index 100% rename from LoanApplication.Db/Data/MasterData.cs/ApplicantCategorySeeder.cs rename to LoanApplication.Db/Data/MasterData/ApplicantCategorySeeder.cs diff --git a/LoanApplication.Db/Data/MasterData.cs/DocumentSeeder.cs b/LoanApplication.Db/Data/MasterData/DocumentSeeder.cs similarity index 100% rename from LoanApplication.Db/Data/MasterData.cs/DocumentSeeder.cs rename to LoanApplication.Db/Data/MasterData/DocumentSeeder.cs diff --git a/LoanApplication.Db/Data/MasterData.cs/LoanCategorySeeder.cs b/LoanApplication.Db/Data/MasterData/LoanCategorySeeder.cs similarity index 100% rename from LoanApplication.Db/Data/MasterData.cs/LoanCategorySeeder.cs rename to LoanApplication.Db/Data/MasterData/LoanCategorySeeder.cs diff --git a/LoanApplication.Db/Data/MasterData.cs/LoanEligibilitySeeder.cs b/LoanApplication.Db/Data/MasterData/LoanEligibilitySeeder.cs similarity index 100% rename from LoanApplication.Db/Data/MasterData.cs/LoanEligibilitySeeder.cs rename to LoanApplication.Db/Data/MasterData/LoanEligibilitySeeder.cs diff --git a/LoanApplication.Db/Data/MasterData.cs/LoanPurposeSeeder.cs b/LoanApplication.Db/Data/MasterData/LoanPurposeSeeder.cs similarity index 100% rename from LoanApplication.Db/Data/MasterData.cs/LoanPurposeSeeder.cs rename to LoanApplication.Db/Data/MasterData/LoanPurposeSeeder.cs diff --git a/LoanApplication.Db/Data/MasterData.cs/LoanTypeSeeder.cs b/LoanApplication.Db/Data/MasterData/LoanTypeSeeder.cs similarity index 100% rename from LoanApplication.Db/Data/MasterData.cs/LoanTypeSeeder.cs rename to LoanApplication.Db/Data/MasterData/LoanTypeSeeder.cs diff --git a/LoanApplication.Db/Data/MasterData.cs/RoleSeeder.cs b/LoanApplication.Db/Data/MasterData/RoleSeeder.cs similarity index 100% rename from LoanApplication.Db/Data/MasterData.cs/RoleSeeder.cs rename to LoanApplication.Db/Data/MasterData/RoleSeeder.cs diff --git a/LoanApplication.Db/Data/MasterData.cs/StatusSeeder.cs b/LoanApplication.Db/Data/MasterData/StatusSeeder.cs similarity index 100% rename from LoanApplication.Db/Data/MasterData.cs/StatusSeeder.cs rename to LoanApplication.Db/Data/MasterData/StatusSeeder.cs -- GitLab