| | 1 | | using System; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using System.Linq; |
| | 4 | | using System.Text; |
| | 5 | | using System.Threading.Tasks; |
| | 6 | | using MUNity.Database.Context; |
| | 7 | |
|
| | 8 | | namespace MUNity.Database.Extensions; |
| | 9 | |
|
| | 10 | | public static class SetupExtensions |
| | 11 | | { |
| | 12 | | public static int SetupBaseCountries(this MunityContext context) |
| 1 | 13 | | => context.AddBaseCountries(BaseData.Countries.BaseCountries); |
| | 14 | |
|
| | 15 | | public static int SetupBaseRoles(this MunityContext context) |
| 1 | 16 | | { |
| | 17 | |
|
| 1 | 18 | | if (!context.Roles.Any()) |
| 1 | 19 | | { |
| 9 | 20 | | foreach (var munityRole in BaseData.DefaultAuthorizations.UserRoles) |
| 3 | 21 | | { |
| 3 | 22 | | context.Roles.Add(munityRole); |
| 3 | 23 | | } |
| 1 | 24 | | } |
| | 25 | |
|
| 1 | 26 | | return context.SaveChanges(); |
| 1 | 27 | | } |
| | 28 | | } |