We have Customer transactional table with multiple lookup tables with foreign keys. We want to create dropdown menus using these lookup tables, when CustomerService creates a Customer order transaction. If a person views the transactions later, they would see the 4 tables joined together.
Would I create
(a) 4 interfaces with 4 repositories,
(b) or 2 interfaces (1 for Customer Transaction, 1 interface for the lookup tables), with 1 Repository for Customer Transaction, and 3 repositories for lookup table interface?
We want to relay Lookup table Repository to the SelectList below. Each select list is picking certain columns. Want to be efficient in code.
Models:
public class CustomerTransaction
{
public int CustomerTransactionId{ get; set; },
public int ProductTypeId {get; set; }, //joins to ProductTypeTable
public int StatusKey {get; set; }, //joins to StatusTypeTable
public int CustomerTypeId {get; set; } //joins to CustomerTypeTable
public string DateOfPurchase{ get; set; },
public string PurchaseAmount { get; set; },
}
public class ProductType
{
public int ProductTypeId{ get; set; }
public int Size { get; set; }
public int Weight { get; set; },
public string ProductName { get; set; },
public string ProductDescription { get; set; },
}
public class StatusType
{
public int StatusKey{ get; set; }
public string Description{ get; set; },
public string Symbol { get; set; },
}
public class CustomerType
{
public int KeyNumber{ get; set; },
public int Height{ get; set; }
public string HairColor{ get; set; },
public string NameOfPerson{ get; set; },
public string ResearchNotes{ get; set; },
}
Required fieldsin dropdown
ViewData["ProductTypeId"] = new SelectList(_context.ProductType, "ProductName", "ProductDescription");
ViewData["KeyNumber"] = new SelectList(_context.CustomerType , "NameofPerson", "Description");
ViewData["StatusKey"] = new SelectList(_context.StatusType, "Symbol", "ResearchNotes");