✅ Asp.Net Help
I'm working on a assignment and really need some help.
We have to make a website where we can show high scores on 4 different games.
I have 2 tables (games and Scores) with a one to many relation between them, where one game can have many scores.
On the submit new high score page I have 4 input fields, the first one is a dropdown where I generated the game.titles from games table.
My problem is when I try to submit the gameId always stays on 0.
28 Replies
Do you have a ParentID in your Game class (business layer)
i have the id property
I think you are using Agregation and Composition
A player has a game and that game has more scores
Your problem could be in the Business/Persistence layer since your ID isn t updating
Have you tried unit testing your business layer?
No i haven't, pretty new to this 😛
You can t be that new if you re working with Composition + Agregation
So
im not sure if there is a problem with the html ive written
Most probably with the back end
Show your aspx page
i will show the exception
K
SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Scores_Games_GameId". The conflict occurred in database "Highscore", table "dbo.Games", column 'Id'.
how i understand this is that the id for the game i choose is 1 and the gameId it's setting is 0
Can you show the database?
Your dbo.games table
yea sure give me a sec
Can you provide a screenshot of all classes in your project?
this is the html form
All the way on the right side
You have your project explorer
don't see it 😛
Can you show your full VS window?
misunderstood what u meant, mb
Oh fck
I wasn t expeting this type of building the website
what u mean m8? hahaha
I never have worked this way
it's Asp.net core MVC
what problem are you facing?
@adoma
Took me time but i fixed the issue. Thanks for the assistance tho 🙂
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.