database
database
EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace banksystem1
{
public class MyAppDbContext : DbContext
{
public DbSet<Customer> Customers { get; set; }
public DbSet<Employee> Employees { get; set; }
public DbSet<Account> Accounts { get; set; }
public DbSet<Loan> Loans { get; set; }
public DbSet<Deposit> Deposits { get; set; }
public DbSet<VerifyCustomer> verifyCustomers { get; set; }
public DbSet<AppRole> appRoles { get; set; }
public DbSet<UserInfo> userInfos { get; set; }
public MyAppDbContext(DbContextOptions opts) : base(opts)
{
}
}
public class Customer
{
[Key]
public int Customer_ID { get; set; }
[Required]
public string Customer_Name { get; set; }
[Required]
public string Customer_Email { get; set; }
[Required]
public string Customer_Password { get; set; }
[Required]
public int Customer_Phone { get; set; }
[Required]
public DateTime Customer_DateOfBirth { get; set; }
[Required]
public int Customer_Aadhar_No { get; set; }
[Required]
[ForeignKey("Customer_ID")]
public Customer accunt { get; set; }
}
public class Loan
{
[Key]
public int Loan_ID { get; set; }
[Required]
public int Customer_ID { get; set; }
[Required]
public int Account_ID { get; set; }
[Required]
public int Employee_ID { get; set; }
[Required]
public int Loan_Ammount { get; set; }
[Required]
public int Interest_Rate { get; set; }
[Required]
public int Durations { get; set; }
[Required]
public int Due_Ammount { get; set; }
[ForeignKey("Employee_ID")]
public Employee emp { get; set; }
}
public class Deposit
{
[Key]
public int Transactions_ID { get; set; }
[Required]
public int Customer_ID { get; set; }
[Required]
public int Account_ID { get; set; }
[Required]
public int Employee_ID { get; set; }
[Required]
public string CrediteOrDeposit { get; set; }
[Required]
public int Ammount { get; set; }
[ForeignKey("Employee_ID")]
public Employee emps { get; set; }
}
public class Employee
{
[Key]
public int Employee_ID { get; set; }
[Required]
public string Employee_Name { get; set; }
[Required]
public string Employee_Email { get; set; }
[Required]
public string Employee_Password { get; set; }
[Required]
public int Employee_Phone { get; set; }
[Required]
public string Employee_Address { get; set; }
}
public class VerifyCustomer
{
[Key]
public int VerifyCustomer_ID { get; set; }
[Required]
public int Customer_ID { get; set; }
}
public class AppRole
{
[Key]
public int Id { get; set; }
[Required]
public string RoleName { get; set; }
public List<UserInfo> UsersInRole { get; set; }
}
public class UserInfo
{
[Key]
public int UId { get; set; }
[Required]
public String UserName { get; set; }
[Required]
public String Password { get; set; }
public int RoleId { get; set; }
[ForeignKey("RoleId")]
public AppRole UserRoles { get; set; }
}
}