Football Betting - svetlilaloli/EntityFramework-SoftUni GitHub Wiki
Entity relations - Code first
Football Betting
The task is to create a database for a Football Bookmaker System, using the Code First approach.
Constraints
Your namespaces should be:
- P03_FootballBetting β for your Startup class, if you have one
- P03_FootballBetting.Data β for your DbContext
- P03_FootballBetting.Data.Models β for your models
Your models should be:
- FootballBettingContext β your DbContext
- Team β TeamId, Name, LogoUrl, Initials (JUV, LIV, ARSβ¦), Budget, PrimaryKitColorId, SecondaryKitColorId, TownId
- Color β ColorId, Name
- Town β TownId, Name, CountryId
- Country β CountryId, Name
- Player β PlayerId, Name, SquadNumber, TeamId, PositionId, IsInjured
- Position β PositionId, Name
- PlayerStatistic β GameId, PlayerId, ScoredGoals, Assists, MinutesPlayed
- Game β GameId, HomeTeamId, AwayTeamId, HomeTeamGoals, AwayTeamGoals, DateTime, HomeTeamBetRate, AwayTeamBetRate, DrawBetRate, Result)
- Bet β BetId, Amount, Prediction, DateTime, UserId, GameId
- User β UserId, Username, Password, Email, Name, Balance
Table relationships:
- A Team has one PrimaryKitColor and one SecondaryKitColor
- A Color has many PrimaryKitTeams and many SecondaryKitTeams
- A Team residents in one Town
- A Town can host several Teams
- A Game has one HomeTeam and one AwayTeam and a Team can have many HomeGames and many AwayGames
- A Town can be placed in one Country and a Country can have many Towns
- A Player can play for one Team and one Team can have many Players
- A Player can play at one Position and one Position can be played by many Players
- One Player can play in many Games and in each Game, many Players take part (both collections must be named PlayerStatistics)
- Many Bets can be placed on one Game, but a Bet can be only on one Game
- Each bet for given game must have Prediction result
- A Bet can be placed by only one User and one User can place many Bets
Separate the models, data, and client into different layers (projects).