Method POST da entidades posts (relacioanmento 1:N) #25
Answered
by
marcelocguilherme
marcelocguilherme
asked this question in
Q&A
-
Tentei implementar o metodo POSTAsync para o posts. Porém como Um Post possui um Author, ele esta tentando persistir o o Auhor no banco, sendo q este já esxite e esta dando erro. Busquei no codigo do projheto para ver se tinha algo parecido mas não encontrei. |
Beta Was this translation helpful? Give feedback.
Answered by
marcelocguilherme
Jun 20, 2022
Replies: 1 comment 1 reply
-
Descobri o problema, esta faltando recuperar o Author antes (var author = context.Author.FirstOrDefault(x => x.Id == model.Author.Id); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
marcelocguilherme
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Descobri o problema, esta faltando recuperar o Author antes (var author = context.Author.FirstOrDefault(x => x.Id == model.Author.Id);
Agora deu certo.