How to make a screen in Asp.net MVC, which lists the ID’s of the same table

Asked

Viewed 60 times

0

Well I have little programming experience so I need help with that.

I have a table called Person, and a table to create the relationship between herself that is called Personal, relationship 1 for several. ie Idpessoa tbl Personal is the idPessoa = x of tbl Person and the Idpartner of tbl Personal is also a Idpessoa = Y.

i have a view index of the controller Person where lists to me all the people registered existing in the table Person, in my idea I would create a button in the view index "relate person" that would redirect to another screen loading the person id in context in the URL (load the id I can).. but I have no idea how to create this "relate person" view where I would like to be able to search the person by name, and click on it already feeding the Personal table

Does anyone have an example code? Remembering I’m using Entityframework 6

inserir a descrição da imagem aqui

  • Friend, I suggest you try to specify a little more what you need to know. I was able to understand that you need to create a relationship of the Person table in 2 key fields in the Person table. Great. But you need an example of what? Try specifying a little more

  • Good ta dificil ate para explica, rsrs, but come on, I have a view index of the controler Person where lists for me all the people registered existing in the table Person, in my idea I would create a button in the view index "relate person" that would redirect to another screen by loading the person’s id in context in the URL (load the id I can).. but I have no idea how to create this "relate person" view where I would like to be able to search the person by name, and click on it already feeding the Personal table

  • For Viewrelacionarpessoa you can create in the same way as in Index, where lists all people. In this case, select the person to be related to (because you already have the first person, who was passed as a parameter) and create a save button.

  • You can avoid work by selecting the two people on the same screen. Grabbing both people’s ID at the same time, thus avoiding more work.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.