Hi. I'm new in implementing asp.net core project. By using CRUD methodology I created a MVC project. In one of my Controller class called ApiApplicantController, in its Edit action, there is an expression like below:
ViewData["Apiid"] = new SelectList(_context.Api, "Id", "Id", apiapplicant.Apiid);
which is totally ambiguis for me to understand.
There is a table called Api that has the following fields: Id,name,lastVersion
Also there is another table called apiapplicant that has the following filed: ApiApplicantId, reqNo, Apiid which is fk to ApiID. Now I want the user when wants to edit a record, the selectList shows the names of Api not the Ids. Accordingly, How can I make that changes to the above SelectList?
What I have tried:
ViewData["Apiid"] = new SelectList(_context.Api, "Id", "Id", apiapplicant.Apiid);