I'm new to Asp.net mvc and dont know how to create a dropdownlist for a table that contains types of loan available. i have to use this table and get rate of interest and do the EMI calculation.. Can you guys help me with this
Here is My Class that contains Loan types and its ids public class LoanType {
public int Id { get; set; }
public string LoanTypeName { get; set; }
public float RateofInterest { get; set; }
}
I have to calculate EMI per month and save the LoanTypeId along with other details in my database(loandetail tbl). Based on the loan type the user selects I should get the rate of interest value from LoanType tbl , but i dont know how to create a dropdownlist in my view.
here is my loandetail table :
[Table("LoanDetail")] public class LoanDetail { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; }
[Required]
public int CustID { get; set; }
[Required]
public string LoanTypeId { get; set; }
[Required]
public float MonthlySalary { get; set; }
[Required]
public float LoanAmount { get; set; }
[Required]
public float TotalAmount { get; set; }
[Required]
public byte Year { get; set; }
[Required]
public float MonthsPaid { get; set; }
[Required]
public float EMIperMonth { get; set; }
[Required]
public float AmountPaid { get; set; }
[Required]
public float BalanceAmount { get; set; }
[ForeignKey("CustID")]
public virtual CustomerDetail CustomerDetails { get; set; }
}
I wanted to know how to create the dropdownlist and use it in my view and to store the LoanTypeId in the Loandetail table in database