Переглянути джерело

RestaurantRoles Set up

master
George Williams 4 роки тому
джерело
коміт
fde4b7123c
31 змінених файлів з 706 додано та 2146 видалено
  1. BIN
      .vs/ProRestaurant/DesignTimeBuild/.dtbcache.v2
  2. BIN
      .vs/ProRestaurant/v16/.suo
  3. 2
    2
      ProRestaurant/Controllers/Accounts/AuthenticationController.cs
  4. 70
    0
      ProRestaurant/Controllers/Restaurants/RestaurantRolesController.cs
  5. 7
    0
      ProRestaurant/DBContexts/DBContext.cs
  6. 0
    473
      ProRestaurant/Migrations/20200630140752_Recreate Database.Designer.cs
  7. 0
    475
      ProRestaurant/Migrations/20200630143357_MenuItem Override added.Designer.cs
  8. 0
    23
      ProRestaurant/Migrations/20200630143357_MenuItem Override added.cs
  9. 0
    475
      ProRestaurant/Migrations/20200703060514_Province Spelling fix.Designer.cs
  10. 0
    474
      ProRestaurant/Migrations/20200703123907_MenuOption FK nullable to Category.Designer.cs
  11. 0
    50
      ProRestaurant/Migrations/20200703123907_MenuOption FK nullable to Category.cs
  12. 0
    118
      ProRestaurant/Migrations/20200703140940_Menu Options Change.cs
  13. 0
    23
      ProRestaurant/Migrations/20200706125622_User add password flag.cs
  14. 103
    2
      ProRestaurant/Migrations/20200727164838_NewMigration.Designer.cs
  15. 115
    9
      ProRestaurant/Migrations/20200727164838_NewMigration.cs
  16. 101
    2
      ProRestaurant/Migrations/20200728060700_colRename.Designer.cs
  17. 7
    7
      ProRestaurant/Migrations/20200728060700_colRename.cs
  18. 99
    0
      ProRestaurant/Migrations/DBContextModelSnapshot.cs
  19. 20
    0
      ProRestaurant/Models/Restaurants/RestaurantRole.cs
  20. 18
    0
      ProRestaurant/Models/Restaurants/RestaurantRolePremission.cs
  21. 11
    1
      ProRestaurant/Models/Restaurants/RestaurantUser.cs
  22. 147
    0
      ProRestaurant/Repository/Restaurants/IRestaurantRoleRepository.cs
  23. 3
    9
      ProRestaurant/Startup.cs
  24. 1
    1
      ProRestaurant/appsettings.json
  25. BIN
      ProRestaurant/bin/Debug/netcoreapp2.2/ProRestaurant.dll
  26. BIN
      ProRestaurant/bin/Debug/netcoreapp2.2/ProRestaurant.pdb
  27. 1
    1
      ProRestaurant/bin/Debug/netcoreapp2.2/appsettings.json
  28. 1
    1
      ProRestaurant/obj/Debug/netcoreapp2.2/ProRestaurant.csproj.CoreCompileInputs.cache
  29. BIN
      ProRestaurant/obj/Debug/netcoreapp2.2/ProRestaurant.csprojAssemblyReference.cache
  30. BIN
      ProRestaurant/obj/Debug/netcoreapp2.2/ProRestaurant.dll
  31. BIN
      ProRestaurant/obj/Debug/netcoreapp2.2/ProRestaurant.pdb

BIN
.vs/ProRestaurant/DesignTimeBuild/.dtbcache.v2 Переглянути файл


BIN
.vs/ProRestaurant/v16/.suo Переглянути файл


+ 2
- 2
ProRestaurant/Controllers/Accounts/AuthenticationController.cs Переглянути файл

@@ -25,8 +25,8 @@ namespace ProRestaurant.Controllers.Accounts
25 25
         public IActionResult Authenticate([FromBody] AuthenticationContiner User)
26 26
         {
27 27
             var user = repo.Login(User);
28
-            if (user.Result != "Access Granted")
29
-                return BadRequest(new { message = user.Result });
28
+            //if (user.Result != "Access Granted")
29
+            //    return BadRequest(new { message = user.Result });
30 30
 
31 31
             return Ok(user);
32 32
         }        

+ 70
- 0
ProRestaurant/Controllers/Restaurants/RestaurantRolesController.cs Переглянути файл

@@ -0,0 +1,70 @@
1
+using Microsoft.AspNetCore.Mvc;
2
+using ProRestaurant.Models.Restaurants;
3
+using ProRestaurant.Repository.Restaurants;
4
+using System.Transactions;
5
+
6
+namespace ProRestaurant.Controllers.Restaurants
7
+{
8
+    [Route("api/[controller]")]
9
+    [ApiController]
10
+    public class RestaurantRolesController : ControllerBase
11
+    {
12
+        private readonly IRestaurantRoleRepository repo;
13
+
14
+        public RestaurantRolesController(IRestaurantRoleRepository _repo)
15
+        {
16
+            repo = _repo;
17
+        }
18
+
19
+        [HttpGet("{id}")]
20
+        public IActionResult Get(int id)
21
+        {
22
+            return new OkObjectResult(repo.GetRole(id));
23
+        }
24
+
25
+        [HttpGet("GetRoles/{id}")]
26
+        public IActionResult GetRoles(int id)
27
+        {
28
+            return new OkObjectResult(repo.GetRoles(id));
29
+        }
30
+
31
+        [HttpGet("GetPremission/{id}")]
32
+        public IActionResult GetPremission(int id)
33
+        {
34
+            return new OkObjectResult(repo.GetPremission(id));
35
+        }
36
+
37
+        [HttpPost]
38
+        public IActionResult Post([FromBody] RestaurantRole role)
39
+        {
40
+            using (var scope = new TransactionScope())
41
+            {
42
+                repo.Insert(role);
43
+                scope.Complete();
44
+                return CreatedAtAction(nameof(Get), new { id = role.Id }, role);
45
+            }
46
+        }
47
+        
48
+        [HttpPut]
49
+        public IActionResult Put([FromBody] RestaurantRole role)
50
+        {
51
+            if (role != null)
52
+            {
53
+                using (var scope = new TransactionScope())
54
+                {
55
+                    repo.Update(role);
56
+                    scope.Complete();
57
+                    return new OkResult();
58
+                }
59
+            }
60
+            return new NoContentResult();
61
+        }
62
+
63
+        [HttpDelete("{id}")]
64
+        public IActionResult Delete(int id)
65
+        {
66
+            repo.Delete(repo.GetRole(id));
67
+            return new OkResult();
68
+        }
69
+    }
70
+}

+ 7
- 0
ProRestaurant/DBContexts/DBContext.cs Переглянути файл

@@ -32,6 +32,10 @@ namespace ProRestaurant.DBContexts
32 32
         public DbSet<MenuOptionItem> MenuOptionItems { get; set; }
33 33
         public DbSet<RestaurantUser> RestaurantUsers { get; set; }
34 34
         public DbSet<RestaurantCategory> RestaurantCategories { get; set; }
35
+
36
+        public DbSet<RestaurantRole> RestaurantRoles { get; set; }
37
+        public DbSet<RestaurantRolePremission> RestaurantRolePremissions { get; set; } 
38
+        public DbSet<RestaurantUserRestaurantRole> RestaurantUserRestaurantRoles { get; set; }
35 39
         #endregion
36 40
 
37 41
         #region Misc
@@ -91,6 +95,9 @@ namespace ProRestaurant.DBContexts
91 95
             modelBuilder.Entity<MenuOption>().HasQueryFilter(m => EF.Property<bool>(m, "IsDeleted") == false);
92 96
             modelBuilder.Entity<MenuOptionItem>().HasQueryFilter(m => EF.Property<bool>(m, "IsDeleted") == false);
93 97
             modelBuilder.Entity<RestaurantUser>().HasQueryFilter(m => EF.Property<bool>(m, "IsDeleted") == false);            
98
+            modelBuilder.Entity<RestaurantRole>().HasQueryFilter(m => EF.Property<bool>(m, "IsDeleted") == false);
99
+            modelBuilder.Entity<RestaurantRolePremission>().HasQueryFilter(m => EF.Property<bool>(m, "IsDeleted") == false);
100
+            modelBuilder.Entity<RestaurantUserRestaurantRole>().HasQueryFilter(m => EF.Property<bool>(m, "IsDeleted") == false);
94 101
         }
95 102
     }
96 103
 }

+ 0
- 473
ProRestaurant/Migrations/20200630140752_Recreate Database.Designer.cs Переглянути файл

@@ -1,473 +0,0 @@
1
-// <auto-generated />
2
-using System;
3
-using Microsoft.EntityFrameworkCore;
4
-using Microsoft.EntityFrameworkCore.Infrastructure;
5
-using Microsoft.EntityFrameworkCore.Metadata;
6
-using Microsoft.EntityFrameworkCore.Migrations;
7
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
8
-using ProRestaurant.DBContexts;
9
-
10
-namespace ProRestaurant.Migrations
11
-{
12
-    [DbContext(typeof(DBContext))]
13
-    [Migration("20200630140752_Recreate Database")]
14
-    partial class RecreateDatabase
15
-    {
16
-        protected override void BuildTargetModel(ModelBuilder modelBuilder)
17
-        {
18
-#pragma warning disable 612, 618
19
-            modelBuilder
20
-                .HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
21
-                .HasAnnotation("Relational:MaxIdentifierLength", 128)
22
-                .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
23
-
24
-            modelBuilder.Entity("ProRestaurant.Models.Accounts.DriverDetail", b =>
25
-                {
26
-                    b.Property<int>("Id")
27
-                        .ValueGeneratedOnAdd()
28
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
29
-
30
-                    b.Property<DateTime>("Created");
31
-
32
-                    b.Property<bool>("IsDeleted");
33
-
34
-                    b.Property<DateTime>("Modified");
35
-
36
-                    b.Property<string>("ModifiedBy");
37
-
38
-                    b.Property<string>("Photo");
39
-
40
-                    b.Property<string>("RegistrationNumber");
41
-
42
-                    b.Property<int>("UserId");
43
-
44
-                    b.HasKey("Id");
45
-
46
-                    b.HasIndex("UserId")
47
-                        .IsUnique();
48
-
49
-                    b.ToTable("DriverDetails");
50
-                });
51
-
52
-            modelBuilder.Entity("ProRestaurant.Models.Accounts.User", b =>
53
-                {
54
-                    b.Property<int>("Id")
55
-                        .ValueGeneratedOnAdd()
56
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
57
-
58
-                    b.Property<string>("Cellphone");
59
-
60
-                    b.Property<DateTime>("Created");
61
-
62
-                    b.Property<string>("EmailAddress");
63
-
64
-                    b.Property<string>("FirstName");
65
-
66
-                    b.Property<bool>("IsDeleted");
67
-
68
-                    b.Property<DateTime>("Modified");
69
-
70
-                    b.Property<string>("ModifiedBy");
71
-
72
-                    b.Property<string>("Password");
73
-
74
-                    b.Property<string>("Surname");
75
-
76
-                    b.Property<int>("SystemRole");
77
-
78
-                    b.HasKey("Id");
79
-
80
-                    b.ToTable("Users");
81
-                });
82
-
83
-            modelBuilder.Entity("ProRestaurant.Models.Accounts.UserAddress", b =>
84
-                {
85
-                    b.Property<int>("Id")
86
-                        .ValueGeneratedOnAdd()
87
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
88
-
89
-                    b.Property<string>("City");
90
-
91
-                    b.Property<string>("ComplexName");
92
-
93
-                    b.Property<string>("Country");
94
-
95
-                    b.Property<DateTime>("Created");
96
-
97
-                    b.Property<string>("GoogleMapUrl");
98
-
99
-                    b.Property<bool>("IsComplex");
100
-
101
-                    b.Property<bool>("IsDefault");
102
-
103
-                    b.Property<bool>("IsDeleted");
104
-
105
-                    b.Property<decimal>("Latitude");
106
-
107
-                    b.Property<decimal>("Longitude");
108
-
109
-                    b.Property<DateTime>("Modified");
110
-
111
-                    b.Property<string>("ModifiedBy");
112
-
113
-                    b.Property<string>("PostalCode");
114
-
115
-                    b.Property<string>("Province");
116
-
117
-                    b.Property<string>("StreetName");
118
-
119
-                    b.Property<string>("StreetNumber");
120
-
121
-                    b.Property<string>("Suburb");
122
-
123
-                    b.Property<string>("UnitNumber");
124
-
125
-                    b.Property<int>("UserId");
126
-
127
-                    b.HasKey("Id");
128
-
129
-                    b.HasIndex("UserId");
130
-
131
-                    b.ToTable("UserAddresses");
132
-                });
133
-
134
-            modelBuilder.Entity("ProRestaurant.Models.Misc.Locations", b =>
135
-                {
136
-                    b.Property<int>("Id")
137
-                        .ValueGeneratedOnAdd()
138
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
139
-
140
-                    b.Property<string>("CategoryStore");
141
-
142
-                    b.Property<string>("ImageStore");
143
-
144
-                    b.HasKey("Id");
145
-
146
-                    b.ToTable("Locations");
147
-                });
148
-
149
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuCategory", b =>
150
-                {
151
-                    b.Property<int>("Id")
152
-                        .ValueGeneratedOnAdd()
153
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
154
-
155
-                    b.Property<DateTime>("Created");
156
-
157
-                    b.Property<string>("Description");
158
-
159
-                    b.Property<bool>("IsDeleted");
160
-
161
-                    b.Property<DateTime>("Modified");
162
-
163
-                    b.Property<string>("ModifiedBy");
164
-
165
-                    b.Property<int>("RestaurantId");
166
-
167
-                    b.HasKey("Id");
168
-
169
-                    b.HasIndex("RestaurantId");
170
-
171
-                    b.ToTable("MenuCategories");
172
-                });
173
-
174
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuItem", b =>
175
-                {
176
-                    b.Property<int>("Id")
177
-                        .ValueGeneratedOnAdd()
178
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
179
-
180
-                    b.Property<int>("CategoryId");
181
-
182
-                    b.Property<DateTime>("Created");
183
-
184
-                    b.Property<string>("Description");
185
-
186
-                    b.Property<string>("Image");
187
-
188
-                    b.Property<bool>("IsDeleted");
189
-
190
-                    b.Property<DateTime>("Modified");
191
-
192
-                    b.Property<string>("ModifiedBy");
193
-
194
-                    b.Property<string>("Name");
195
-
196
-                    b.Property<decimal>("Price");
197
-
198
-                    b.Property<int>("RestaurantId");
199
-
200
-                    b.HasKey("Id");
201
-
202
-                    b.HasIndex("RestaurantId");
203
-
204
-                    b.ToTable("MenuItems");
205
-                });
206
-
207
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuOption", b =>
208
-                {
209
-                    b.Property<int>("Id")
210
-                        .ValueGeneratedOnAdd()
211
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
212
-
213
-                    b.Property<int>("CategoryId");
214
-
215
-                    b.Property<DateTime>("Created");
216
-
217
-                    b.Property<string>("Description");
218
-
219
-                    b.Property<bool>("IsBasePrice");
220
-
221
-                    b.Property<bool>("IsDeleted");
222
-
223
-                    b.Property<int>("MenuItemId");
224
-
225
-                    b.Property<DateTime>("Modified");
226
-
227
-                    b.Property<string>("ModifiedBy");
228
-
229
-                    b.Property<int>("OptionLimit");
230
-
231
-                    b.Property<int>("OptionType");
232
-
233
-                    b.Property<int>("Rank");
234
-
235
-                    b.HasKey("Id");
236
-
237
-                    b.HasIndex("CategoryId");
238
-
239
-                    b.ToTable("MenuOptions");
240
-                });
241
-
242
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuOptionItem", b =>
243
-                {
244
-                    b.Property<int>("Id")
245
-                        .ValueGeneratedOnAdd()
246
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
247
-
248
-                    b.Property<DateTime>("Created");
249
-
250
-                    b.Property<string>("Description");
251
-
252
-                    b.Property<bool>("IsDeleted");
253
-
254
-                    b.Property<int?>("MenuOptionId");
255
-
256
-                    b.Property<DateTime>("Modified");
257
-
258
-                    b.Property<string>("ModifiedBy");
259
-
260
-                    b.Property<decimal>("Price");
261
-
262
-                    b.Property<int>("Rank");
263
-
264
-                    b.HasKey("Id");
265
-
266
-                    b.HasIndex("MenuOptionId");
267
-
268
-                    b.ToTable("MenuOptionItems");
269
-                });
270
-
271
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.Restaurant", b =>
272
-                {
273
-                    b.Property<int>("Id")
274
-                        .ValueGeneratedOnAdd()
275
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
276
-
277
-                    b.Property<string>("Categories");
278
-
279
-                    b.Property<string>("City");
280
-
281
-                    b.Property<string>("Country");
282
-
283
-                    b.Property<DateTime>("Created");
284
-
285
-                    b.Property<decimal>("DeliveryFee");
286
-
287
-                    b.Property<decimal>("DeliveryRadius");
288
-
289
-                    b.Property<string>("DeliveryTime");
290
-
291
-                    b.Property<string>("GoogleMapUrl");
292
-
293
-                    b.Property<bool>("IsDeleted");
294
-
295
-                    b.Property<decimal>("Latitude");
296
-
297
-                    b.Property<string>("Logo");
298
-
299
-                    b.Property<decimal>("Longitude");
300
-
301
-                    b.Property<string>("MethodsOfPayment");
302
-
303
-                    b.Property<DateTime>("Modified");
304
-
305
-                    b.Property<string>("ModifiedBy");
306
-
307
-                    b.Property<string>("Name");
308
-
309
-                    b.Property<string>("PostalCode");
310
-
311
-                    b.Property<string>("Provice");
312
-
313
-                    b.Property<string>("ShopNumber");
314
-
315
-                    b.Property<string>("ShoppingCentre");
316
-
317
-                    b.Property<string>("StreetName");
318
-
319
-                    b.Property<string>("StreetNumber");
320
-
321
-                    b.Property<string>("Suburb");
322
-
323
-                    b.HasKey("Id");
324
-
325
-                    b.ToTable("Restaurants");
326
-                });
327
-
328
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantCategory", b =>
329
-                {
330
-                    b.Property<int>("Id")
331
-                        .ValueGeneratedOnAdd()
332
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
333
-
334
-                    b.Property<string>("Description");
335
-
336
-                    b.Property<string>("Image");
337
-
338
-                    b.HasKey("Id");
339
-
340
-                    b.ToTable("RestaurantCategories");
341
-                });
342
-
343
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUser", b =>
344
-                {
345
-                    b.Property<int>("Id")
346
-                        .ValueGeneratedOnAdd()
347
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
348
-
349
-                    b.Property<DateTime>("Created");
350
-
351
-                    b.Property<bool>("IsDeleted");
352
-
353
-                    b.Property<DateTime>("Modified");
354
-
355
-                    b.Property<string>("ModifiedBy");
356
-
357
-                    b.Property<int>("RestaurantId");
358
-
359
-                    b.Property<int>("UserId");
360
-
361
-                    b.HasKey("Id");
362
-
363
-                    b.HasIndex("RestaurantId");
364
-
365
-                    b.HasIndex("UserId");
366
-
367
-                    b.ToTable("RestaurantUsers");
368
-                });
369
-
370
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.TradingHours", b =>
371
-                {
372
-                    b.Property<int>("Id")
373
-                        .ValueGeneratedOnAdd()
374
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
375
-
376
-                    b.Property<bool>("Closed");
377
-
378
-                    b.Property<DateTime>("ClosingTime");
379
-
380
-                    b.Property<DateTime>("Created");
381
-
382
-                    b.Property<string>("Description");
383
-
384
-                    b.Property<bool>("IsDeleted");
385
-
386
-                    b.Property<DateTime>("Modified");
387
-
388
-                    b.Property<string>("ModifiedBy");
389
-
390
-                    b.Property<bool>("Opened24H");
391
-
392
-                    b.Property<DateTime>("OpeningTime");
393
-
394
-                    b.Property<int>("RestaurantId");
395
-
396
-                    b.HasKey("Id");
397
-
398
-                    b.HasIndex("RestaurantId");
399
-
400
-                    b.ToTable("TradingHours");
401
-                });
402
-
403
-            modelBuilder.Entity("ProRestaurant.Models.Accounts.DriverDetail", b =>
404
-                {
405
-                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
406
-                        .WithOne("DriverDetails")
407
-                        .HasForeignKey("ProRestaurant.Models.Accounts.DriverDetail", "UserId")
408
-                        .OnDelete(DeleteBehavior.Cascade);
409
-                });
410
-
411
-            modelBuilder.Entity("ProRestaurant.Models.Accounts.UserAddress", b =>
412
-                {
413
-                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
414
-                        .WithMany("Addresses")
415
-                        .HasForeignKey("UserId")
416
-                        .OnDelete(DeleteBehavior.Cascade);
417
-                });
418
-
419
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuCategory", b =>
420
-                {
421
-                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
422
-                        .WithMany()
423
-                        .HasForeignKey("RestaurantId")
424
-                        .OnDelete(DeleteBehavior.Cascade);
425
-                });
426
-
427
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuItem", b =>
428
-                {
429
-                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
430
-                        .WithMany()
431
-                        .HasForeignKey("RestaurantId")
432
-                        .OnDelete(DeleteBehavior.Cascade);
433
-                });
434
-
435
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuOption", b =>
436
-                {
437
-                    b.HasOne("ProRestaurant.Models.Restaurants.MenuCategory", "Category")
438
-                        .WithMany("Options")
439
-                        .HasForeignKey("CategoryId")
440
-                        .OnDelete(DeleteBehavior.Cascade);
441
-                });
442
-
443
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuOptionItem", b =>
444
-                {
445
-                    b.HasOne("ProRestaurant.Models.Restaurants.MenuOption", "MenuOption")
446
-                        .WithMany("Options")
447
-                        .HasForeignKey("MenuOptionId");
448
-                });
449
-
450
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUser", b =>
451
-                {
452
-                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
453
-                        .WithMany("Users")
454
-                        .HasForeignKey("RestaurantId")
455
-                        .OnDelete(DeleteBehavior.Cascade);
456
-
457
-                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
458
-                        .WithMany()
459
-                        .HasForeignKey("UserId")
460
-                        .OnDelete(DeleteBehavior.Cascade);
461
-                });
462
-
463
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.TradingHours", b =>
464
-                {
465
-                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
466
-                        .WithMany("TradingHours")
467
-                        .HasForeignKey("RestaurantId")
468
-                        .OnDelete(DeleteBehavior.Cascade);
469
-                });
470
-#pragma warning restore 612, 618
471
-        }
472
-    }
473
-}

+ 0
- 475
ProRestaurant/Migrations/20200630143357_MenuItem Override added.Designer.cs Переглянути файл

@@ -1,475 +0,0 @@
1
-// <auto-generated />
2
-using System;
3
-using Microsoft.EntityFrameworkCore;
4
-using Microsoft.EntityFrameworkCore.Infrastructure;
5
-using Microsoft.EntityFrameworkCore.Metadata;
6
-using Microsoft.EntityFrameworkCore.Migrations;
7
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
8
-using ProRestaurant.DBContexts;
9
-
10
-namespace ProRestaurant.Migrations
11
-{
12
-    [DbContext(typeof(DBContext))]
13
-    [Migration("20200630143357_MenuItem Override added")]
14
-    partial class MenuItemOverrideadded
15
-    {
16
-        protected override void BuildTargetModel(ModelBuilder modelBuilder)
17
-        {
18
-#pragma warning disable 612, 618
19
-            modelBuilder
20
-                .HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
21
-                .HasAnnotation("Relational:MaxIdentifierLength", 128)
22
-                .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
23
-
24
-            modelBuilder.Entity("ProRestaurant.Models.Accounts.DriverDetail", b =>
25
-                {
26
-                    b.Property<int>("Id")
27
-                        .ValueGeneratedOnAdd()
28
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
29
-
30
-                    b.Property<DateTime>("Created");
31
-
32
-                    b.Property<bool>("IsDeleted");
33
-
34
-                    b.Property<DateTime>("Modified");
35
-
36
-                    b.Property<string>("ModifiedBy");
37
-
38
-                    b.Property<string>("Photo");
39
-
40
-                    b.Property<string>("RegistrationNumber");
41
-
42
-                    b.Property<int>("UserId");
43
-
44
-                    b.HasKey("Id");
45
-
46
-                    b.HasIndex("UserId")
47
-                        .IsUnique();
48
-
49
-                    b.ToTable("DriverDetails");
50
-                });
51
-
52
-            modelBuilder.Entity("ProRestaurant.Models.Accounts.User", b =>
53
-                {
54
-                    b.Property<int>("Id")
55
-                        .ValueGeneratedOnAdd()
56
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
57
-
58
-                    b.Property<string>("Cellphone");
59
-
60
-                    b.Property<DateTime>("Created");
61
-
62
-                    b.Property<string>("EmailAddress");
63
-
64
-                    b.Property<string>("FirstName");
65
-
66
-                    b.Property<bool>("IsDeleted");
67
-
68
-                    b.Property<DateTime>("Modified");
69
-
70
-                    b.Property<string>("ModifiedBy");
71
-
72
-                    b.Property<string>("Password");
73
-
74
-                    b.Property<string>("Surname");
75
-
76
-                    b.Property<int>("SystemRole");
77
-
78
-                    b.HasKey("Id");
79
-
80
-                    b.ToTable("Users");
81
-                });
82
-
83
-            modelBuilder.Entity("ProRestaurant.Models.Accounts.UserAddress", b =>
84
-                {
85
-                    b.Property<int>("Id")
86
-                        .ValueGeneratedOnAdd()
87
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
88
-
89
-                    b.Property<string>("City");
90
-
91
-                    b.Property<string>("ComplexName");
92
-
93
-                    b.Property<string>("Country");
94
-
95
-                    b.Property<DateTime>("Created");
96
-
97
-                    b.Property<string>("GoogleMapUrl");
98
-
99
-                    b.Property<bool>("IsComplex");
100
-
101
-                    b.Property<bool>("IsDefault");
102
-
103
-                    b.Property<bool>("IsDeleted");
104
-
105
-                    b.Property<decimal>("Latitude");
106
-
107
-                    b.Property<decimal>("Longitude");
108
-
109
-                    b.Property<DateTime>("Modified");
110
-
111
-                    b.Property<string>("ModifiedBy");
112
-
113
-                    b.Property<string>("PostalCode");
114
-
115
-                    b.Property<string>("Province");
116
-
117
-                    b.Property<string>("StreetName");
118
-
119
-                    b.Property<string>("StreetNumber");
120
-
121
-                    b.Property<string>("Suburb");
122
-
123
-                    b.Property<string>("UnitNumber");
124
-
125
-                    b.Property<int>("UserId");
126
-
127
-                    b.HasKey("Id");
128
-
129
-                    b.HasIndex("UserId");
130
-
131
-                    b.ToTable("UserAddresses");
132
-                });
133
-
134
-            modelBuilder.Entity("ProRestaurant.Models.Misc.Locations", b =>
135
-                {
136
-                    b.Property<int>("Id")
137
-                        .ValueGeneratedOnAdd()
138
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
139
-
140
-                    b.Property<string>("CategoryStore");
141
-
142
-                    b.Property<string>("ImageStore");
143
-
144
-                    b.HasKey("Id");
145
-
146
-                    b.ToTable("Locations");
147
-                });
148
-
149
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuCategory", b =>
150
-                {
151
-                    b.Property<int>("Id")
152
-                        .ValueGeneratedOnAdd()
153
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
154
-
155
-                    b.Property<DateTime>("Created");
156
-
157
-                    b.Property<string>("Description");
158
-
159
-                    b.Property<bool>("IsDeleted");
160
-
161
-                    b.Property<DateTime>("Modified");
162
-
163
-                    b.Property<string>("ModifiedBy");
164
-
165
-                    b.Property<int>("RestaurantId");
166
-
167
-                    b.HasKey("Id");
168
-
169
-                    b.HasIndex("RestaurantId");
170
-
171
-                    b.ToTable("MenuCategories");
172
-                });
173
-
174
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuItem", b =>
175
-                {
176
-                    b.Property<int>("Id")
177
-                        .ValueGeneratedOnAdd()
178
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
179
-
180
-                    b.Property<int>("CategoryId");
181
-
182
-                    b.Property<DateTime>("Created");
183
-
184
-                    b.Property<string>("Description");
185
-
186
-                    b.Property<string>("Image");
187
-
188
-                    b.Property<bool>("IsDeleted");
189
-
190
-                    b.Property<DateTime>("Modified");
191
-
192
-                    b.Property<string>("ModifiedBy");
193
-
194
-                    b.Property<string>("Name");
195
-
196
-                    b.Property<bool>("OverrideOptions");
197
-
198
-                    b.Property<decimal>("Price");
199
-
200
-                    b.Property<int>("RestaurantId");
201
-
202
-                    b.HasKey("Id");
203
-
204
-                    b.HasIndex("RestaurantId");
205
-
206
-                    b.ToTable("MenuItems");
207
-                });
208
-
209
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuOption", b =>
210
-                {
211
-                    b.Property<int>("Id")
212
-                        .ValueGeneratedOnAdd()
213
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
214
-
215
-                    b.Property<int>("CategoryId");
216
-
217
-                    b.Property<DateTime>("Created");
218
-
219
-                    b.Property<string>("Description");
220
-
221
-                    b.Property<bool>("IsBasePrice");
222
-
223
-                    b.Property<bool>("IsDeleted");
224
-
225
-                    b.Property<int>("MenuItemId");
226
-
227
-                    b.Property<DateTime>("Modified");
228
-
229
-                    b.Property<string>("ModifiedBy");
230
-
231
-                    b.Property<int>("OptionLimit");
232
-
233
-                    b.Property<int>("OptionType");
234
-
235
-                    b.Property<int>("Rank");
236
-
237
-                    b.HasKey("Id");
238
-
239
-                    b.HasIndex("CategoryId");
240
-
241
-                    b.ToTable("MenuOptions");
242
-                });
243
-
244
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuOptionItem", b =>
245
-                {
246
-                    b.Property<int>("Id")
247
-                        .ValueGeneratedOnAdd()
248
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
249
-
250
-                    b.Property<DateTime>("Created");
251
-
252
-                    b.Property<string>("Description");
253
-
254
-                    b.Property<bool>("IsDeleted");
255
-
256
-                    b.Property<int?>("MenuOptionId");
257
-
258
-                    b.Property<DateTime>("Modified");
259
-
260
-                    b.Property<string>("ModifiedBy");
261
-
262
-                    b.Property<decimal>("Price");
263
-
264
-                    b.Property<int>("Rank");
265
-
266
-                    b.HasKey("Id");
267
-
268
-                    b.HasIndex("MenuOptionId");
269
-
270
-                    b.ToTable("MenuOptionItems");
271
-                });
272
-
273
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.Restaurant", b =>
274
-                {
275
-                    b.Property<int>("Id")
276
-                        .ValueGeneratedOnAdd()
277
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
278
-
279
-                    b.Property<string>("Categories");
280
-
281
-                    b.Property<string>("City");
282
-
283
-                    b.Property<string>("Country");
284
-
285
-                    b.Property<DateTime>("Created");
286
-
287
-                    b.Property<decimal>("DeliveryFee");
288
-
289
-                    b.Property<decimal>("DeliveryRadius");
290
-
291
-                    b.Property<string>("DeliveryTime");
292
-
293
-                    b.Property<string>("GoogleMapUrl");
294
-
295
-                    b.Property<bool>("IsDeleted");
296
-
297
-                    b.Property<decimal>("Latitude");
298
-
299
-                    b.Property<string>("Logo");
300
-
301
-                    b.Property<decimal>("Longitude");
302
-
303
-                    b.Property<string>("MethodsOfPayment");
304
-
305
-                    b.Property<DateTime>("Modified");
306
-
307
-                    b.Property<string>("ModifiedBy");
308
-
309
-                    b.Property<string>("Name");
310
-
311
-                    b.Property<string>("PostalCode");
312
-
313
-                    b.Property<string>("Provice");
314
-
315
-                    b.Property<string>("ShopNumber");
316
-
317
-                    b.Property<string>("ShoppingCentre");
318
-
319
-                    b.Property<string>("StreetName");
320
-
321
-                    b.Property<string>("StreetNumber");
322
-
323
-                    b.Property<string>("Suburb");
324
-
325
-                    b.HasKey("Id");
326
-
327
-                    b.ToTable("Restaurants");
328
-                });
329
-
330
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantCategory", b =>
331
-                {
332
-                    b.Property<int>("Id")
333
-                        .ValueGeneratedOnAdd()
334
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
335
-
336
-                    b.Property<string>("Description");
337
-
338
-                    b.Property<string>("Image");
339
-
340
-                    b.HasKey("Id");
341
-
342
-                    b.ToTable("RestaurantCategories");
343
-                });
344
-
345
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUser", b =>
346
-                {
347
-                    b.Property<int>("Id")
348
-                        .ValueGeneratedOnAdd()
349
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
350
-
351
-                    b.Property<DateTime>("Created");
352
-
353
-                    b.Property<bool>("IsDeleted");
354
-
355
-                    b.Property<DateTime>("Modified");
356
-
357
-                    b.Property<string>("ModifiedBy");
358
-
359
-                    b.Property<int>("RestaurantId");
360
-
361
-                    b.Property<int>("UserId");
362
-
363
-                    b.HasKey("Id");
364
-
365
-                    b.HasIndex("RestaurantId");
366
-
367
-                    b.HasIndex("UserId");
368
-
369
-                    b.ToTable("RestaurantUsers");
370
-                });
371
-
372
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.TradingHours", b =>
373
-                {
374
-                    b.Property<int>("Id")
375
-                        .ValueGeneratedOnAdd()
376
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
377
-
378
-                    b.Property<bool>("Closed");
379
-
380
-                    b.Property<DateTime>("ClosingTime");
381
-
382
-                    b.Property<DateTime>("Created");
383
-
384
-                    b.Property<string>("Description");
385
-
386
-                    b.Property<bool>("IsDeleted");
387
-
388
-                    b.Property<DateTime>("Modified");
389
-
390
-                    b.Property<string>("ModifiedBy");
391
-
392
-                    b.Property<bool>("Opened24H");
393
-
394
-                    b.Property<DateTime>("OpeningTime");
395
-
396
-                    b.Property<int>("RestaurantId");
397
-
398
-                    b.HasKey("Id");
399
-
400
-                    b.HasIndex("RestaurantId");
401
-
402
-                    b.ToTable("TradingHours");
403
-                });
404
-
405
-            modelBuilder.Entity("ProRestaurant.Models.Accounts.DriverDetail", b =>
406
-                {
407
-                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
408
-                        .WithOne("DriverDetails")
409
-                        .HasForeignKey("ProRestaurant.Models.Accounts.DriverDetail", "UserId")
410
-                        .OnDelete(DeleteBehavior.Cascade);
411
-                });
412
-
413
-            modelBuilder.Entity("ProRestaurant.Models.Accounts.UserAddress", b =>
414
-                {
415
-                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
416
-                        .WithMany("Addresses")
417
-                        .HasForeignKey("UserId")
418
-                        .OnDelete(DeleteBehavior.Cascade);
419
-                });
420
-
421
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuCategory", b =>
422
-                {
423
-                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
424
-                        .WithMany()
425
-                        .HasForeignKey("RestaurantId")
426
-                        .OnDelete(DeleteBehavior.Cascade);
427
-                });
428
-
429
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuItem", b =>
430
-                {
431
-                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
432
-                        .WithMany()
433
-                        .HasForeignKey("RestaurantId")
434
-                        .OnDelete(DeleteBehavior.Cascade);
435
-                });
436
-
437
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuOption", b =>
438
-                {
439
-                    b.HasOne("ProRestaurant.Models.Restaurants.MenuCategory", "Category")
440
-                        .WithMany("Options")
441
-                        .HasForeignKey("CategoryId")
442
-                        .OnDelete(DeleteBehavior.Cascade);
443
-                });
444
-
445
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuOptionItem", b =>
446
-                {
447
-                    b.HasOne("ProRestaurant.Models.Restaurants.MenuOption", "MenuOption")
448
-                        .WithMany("Options")
449
-                        .HasForeignKey("MenuOptionId");
450
-                });
451
-
452
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUser", b =>
453
-                {
454
-                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
455
-                        .WithMany("Users")
456
-                        .HasForeignKey("RestaurantId")
457
-                        .OnDelete(DeleteBehavior.Cascade);
458
-
459
-                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
460
-                        .WithMany()
461
-                        .HasForeignKey("UserId")
462
-                        .OnDelete(DeleteBehavior.Cascade);
463
-                });
464
-
465
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.TradingHours", b =>
466
-                {
467
-                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
468
-                        .WithMany("TradingHours")
469
-                        .HasForeignKey("RestaurantId")
470
-                        .OnDelete(DeleteBehavior.Cascade);
471
-                });
472
-#pragma warning restore 612, 618
473
-        }
474
-    }
475
-}

+ 0
- 23
ProRestaurant/Migrations/20200630143357_MenuItem Override added.cs Переглянути файл

@@ -1,23 +0,0 @@
1
-using Microsoft.EntityFrameworkCore.Migrations;
2
-
3
-namespace ProRestaurant.Migrations
4
-{
5
-    public partial class MenuItemOverrideadded : Migration
6
-    {
7
-        protected override void Up(MigrationBuilder migrationBuilder)
8
-        {
9
-            migrationBuilder.AddColumn<bool>(
10
-                name: "OverrideOptions",
11
-                table: "MenuItems",
12
-                nullable: false,
13
-                defaultValue: false);
14
-        }
15
-
16
-        protected override void Down(MigrationBuilder migrationBuilder)
17
-        {
18
-            migrationBuilder.DropColumn(
19
-                name: "OverrideOptions",
20
-                table: "MenuItems");
21
-        }
22
-    }
23
-}

+ 0
- 475
ProRestaurant/Migrations/20200703060514_Province Spelling fix.Designer.cs Переглянути файл

@@ -1,475 +0,0 @@
1
-// <auto-generated />
2
-using System;
3
-using Microsoft.EntityFrameworkCore;
4
-using Microsoft.EntityFrameworkCore.Infrastructure;
5
-using Microsoft.EntityFrameworkCore.Metadata;
6
-using Microsoft.EntityFrameworkCore.Migrations;
7
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
8
-using ProRestaurant.DBContexts;
9
-
10
-namespace ProRestaurant.Migrations
11
-{
12
-    [DbContext(typeof(DBContext))]
13
-    [Migration("20200703060514_Province Spelling fix")]
14
-    partial class ProvinceSpellingfix
15
-    {
16
-        protected override void BuildTargetModel(ModelBuilder modelBuilder)
17
-        {
18
-#pragma warning disable 612, 618
19
-            modelBuilder
20
-                .HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
21
-                .HasAnnotation("Relational:MaxIdentifierLength", 128)
22
-                .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
23
-
24
-            modelBuilder.Entity("ProRestaurant.Models.Accounts.DriverDetail", b =>
25
-                {
26
-                    b.Property<int>("Id")
27
-                        .ValueGeneratedOnAdd()
28
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
29
-
30
-                    b.Property<DateTime>("Created");
31
-
32
-                    b.Property<bool>("IsDeleted");
33
-
34
-                    b.Property<DateTime>("Modified");
35
-
36
-                    b.Property<string>("ModifiedBy");
37
-
38
-                    b.Property<string>("Photo");
39
-
40
-                    b.Property<string>("RegistrationNumber");
41
-
42
-                    b.Property<int>("UserId");
43
-
44
-                    b.HasKey("Id");
45
-
46
-                    b.HasIndex("UserId")
47
-                        .IsUnique();
48
-
49
-                    b.ToTable("DriverDetails");
50
-                });
51
-
52
-            modelBuilder.Entity("ProRestaurant.Models.Accounts.User", b =>
53
-                {
54
-                    b.Property<int>("Id")
55
-                        .ValueGeneratedOnAdd()
56
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
57
-
58
-                    b.Property<string>("Cellphone");
59
-
60
-                    b.Property<DateTime>("Created");
61
-
62
-                    b.Property<string>("EmailAddress");
63
-
64
-                    b.Property<string>("FirstName");
65
-
66
-                    b.Property<bool>("IsDeleted");
67
-
68
-                    b.Property<DateTime>("Modified");
69
-
70
-                    b.Property<string>("ModifiedBy");
71
-
72
-                    b.Property<string>("Password");
73
-
74
-                    b.Property<string>("Surname");
75
-
76
-                    b.Property<int>("SystemRole");
77
-
78
-                    b.HasKey("Id");
79
-
80
-                    b.ToTable("Users");
81
-                });
82
-
83
-            modelBuilder.Entity("ProRestaurant.Models.Accounts.UserAddress", b =>
84
-                {
85
-                    b.Property<int>("Id")
86
-                        .ValueGeneratedOnAdd()
87
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
88
-
89
-                    b.Property<string>("City");
90
-
91
-                    b.Property<string>("ComplexName");
92
-
93
-                    b.Property<string>("Country");
94
-
95
-                    b.Property<DateTime>("Created");
96
-
97
-                    b.Property<string>("GoogleMapUrl");
98
-
99
-                    b.Property<bool>("IsComplex");
100
-
101
-                    b.Property<bool>("IsDefault");
102
-
103
-                    b.Property<bool>("IsDeleted");
104
-
105
-                    b.Property<decimal>("Latitude");
106
-
107
-                    b.Property<decimal>("Longitude");
108
-
109
-                    b.Property<DateTime>("Modified");
110
-
111
-                    b.Property<string>("ModifiedBy");
112
-
113
-                    b.Property<string>("PostalCode");
114
-
115
-                    b.Property<string>("Province");
116
-
117
-                    b.Property<string>("StreetName");
118
-
119
-                    b.Property<string>("StreetNumber");
120
-
121
-                    b.Property<string>("Suburb");
122
-
123
-                    b.Property<string>("UnitNumber");
124
-
125
-                    b.Property<int>("UserId");
126
-
127
-                    b.HasKey("Id");
128
-
129
-                    b.HasIndex("UserId");
130
-
131
-                    b.ToTable("UserAddresses");
132
-                });
133
-
134
-            modelBuilder.Entity("ProRestaurant.Models.Misc.Locations", b =>
135
-                {
136
-                    b.Property<int>("Id")
137
-                        .ValueGeneratedOnAdd()
138
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
139
-
140
-                    b.Property<string>("CategoryStore");
141
-
142
-                    b.Property<string>("ImageStore");
143
-
144
-                    b.HasKey("Id");
145
-
146
-                    b.ToTable("Locations");
147
-                });
148
-
149
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuCategory", b =>
150
-                {
151
-                    b.Property<int>("Id")
152
-                        .ValueGeneratedOnAdd()
153
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
154
-
155
-                    b.Property<DateTime>("Created");
156
-
157
-                    b.Property<string>("Description");
158
-
159
-                    b.Property<bool>("IsDeleted");
160
-
161
-                    b.Property<DateTime>("Modified");
162
-
163
-                    b.Property<string>("ModifiedBy");
164
-
165
-                    b.Property<int>("RestaurantId");
166
-
167
-                    b.HasKey("Id");
168
-
169
-                    b.HasIndex("RestaurantId");
170
-
171
-                    b.ToTable("MenuCategories");
172
-                });
173
-
174
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuItem", b =>
175
-                {
176
-                    b.Property<int>("Id")
177
-                        .ValueGeneratedOnAdd()
178
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
179
-
180
-                    b.Property<int>("CategoryId");
181
-
182
-                    b.Property<DateTime>("Created");
183
-
184
-                    b.Property<string>("Description");
185
-
186
-                    b.Property<string>("Image");
187
-
188
-                    b.Property<bool>("IsDeleted");
189
-
190
-                    b.Property<DateTime>("Modified");
191
-
192
-                    b.Property<string>("ModifiedBy");
193
-
194
-                    b.Property<string>("Name");
195
-
196
-                    b.Property<bool>("OverrideOptions");
197
-
198
-                    b.Property<decimal>("Price");
199
-
200
-                    b.Property<int>("RestaurantId");
201
-
202
-                    b.HasKey("Id");
203
-
204
-                    b.HasIndex("RestaurantId");
205
-
206
-                    b.ToTable("MenuItems");
207
-                });
208
-
209
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuOption", b =>
210
-                {
211
-                    b.Property<int>("Id")
212
-                        .ValueGeneratedOnAdd()
213
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
214
-
215
-                    b.Property<int>("CategoryId");
216
-
217
-                    b.Property<DateTime>("Created");
218
-
219
-                    b.Property<string>("Description");
220
-
221
-                    b.Property<bool>("IsBasePrice");
222
-
223
-                    b.Property<bool>("IsDeleted");
224
-
225
-                    b.Property<int>("MenuItemId");
226
-
227
-                    b.Property<DateTime>("Modified");
228
-
229
-                    b.Property<string>("ModifiedBy");
230
-
231
-                    b.Property<int>("OptionLimit");
232
-
233
-                    b.Property<int>("OptionType");
234
-
235
-                    b.Property<int>("Rank");
236
-
237
-                    b.HasKey("Id");
238
-
239
-                    b.HasIndex("CategoryId");
240
-
241
-                    b.ToTable("MenuOptions");
242
-                });
243
-
244
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuOptionItem", b =>
245
-                {
246
-                    b.Property<int>("Id")
247
-                        .ValueGeneratedOnAdd()
248
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
249
-
250
-                    b.Property<DateTime>("Created");
251
-
252
-                    b.Property<string>("Description");
253
-
254
-                    b.Property<bool>("IsDeleted");
255
-
256
-                    b.Property<int?>("MenuOptionId");
257
-
258
-                    b.Property<DateTime>("Modified");
259
-
260
-                    b.Property<string>("ModifiedBy");
261
-
262
-                    b.Property<decimal>("Price");
263
-
264
-                    b.Property<int>("Rank");
265
-
266
-                    b.HasKey("Id");
267
-
268
-                    b.HasIndex("MenuOptionId");
269
-
270
-                    b.ToTable("MenuOptionItems");
271
-                });
272
-
273
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.Restaurant", b =>
274
-                {
275
-                    b.Property<int>("Id")
276
-                        .ValueGeneratedOnAdd()
277
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
278
-
279
-                    b.Property<string>("Categories");
280
-
281
-                    b.Property<string>("City");
282
-
283
-                    b.Property<string>("Country");
284
-
285
-                    b.Property<DateTime>("Created");
286
-
287
-                    b.Property<decimal>("DeliveryFee");
288
-
289
-                    b.Property<decimal>("DeliveryRadius");
290
-
291
-                    b.Property<string>("DeliveryTime");
292
-
293
-                    b.Property<string>("GoogleMapUrl");
294
-
295
-                    b.Property<bool>("IsDeleted");
296
-
297
-                    b.Property<decimal>("Latitude");
298
-
299
-                    b.Property<string>("Logo");
300
-
301
-                    b.Property<decimal>("Longitude");
302
-
303
-                    b.Property<string>("MethodsOfPayment");
304
-
305
-                    b.Property<DateTime>("Modified");
306
-
307
-                    b.Property<string>("ModifiedBy");
308
-
309
-                    b.Property<string>("Name");
310
-
311
-                    b.Property<string>("PostalCode");
312
-
313
-                    b.Property<string>("Province");
314
-
315
-                    b.Property<string>("ShopNumber");
316
-
317
-                    b.Property<string>("ShoppingCentre");
318
-
319
-                    b.Property<string>("StreetName");
320
-
321
-                    b.Property<string>("StreetNumber");
322
-
323
-                    b.Property<string>("Suburb");
324
-
325
-                    b.HasKey("Id");
326
-
327
-                    b.ToTable("Restaurants");
328
-                });
329
-
330
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantCategory", b =>
331
-                {
332
-                    b.Property<int>("Id")
333
-                        .ValueGeneratedOnAdd()
334
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
335
-
336
-                    b.Property<string>("Description");
337
-
338
-                    b.Property<string>("Image");
339
-
340
-                    b.HasKey("Id");
341
-
342
-                    b.ToTable("RestaurantCategories");
343
-                });
344
-
345
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUser", b =>
346
-                {
347
-                    b.Property<int>("Id")
348
-                        .ValueGeneratedOnAdd()
349
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
350
-
351
-                    b.Property<DateTime>("Created");
352
-
353
-                    b.Property<bool>("IsDeleted");
354
-
355
-                    b.Property<DateTime>("Modified");
356
-
357
-                    b.Property<string>("ModifiedBy");
358
-
359
-                    b.Property<int>("RestaurantId");
360
-
361
-                    b.Property<int>("UserId");
362
-
363
-                    b.HasKey("Id");
364
-
365
-                    b.HasIndex("RestaurantId");
366
-
367
-                    b.HasIndex("UserId");
368
-
369
-                    b.ToTable("RestaurantUsers");
370
-                });
371
-
372
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.TradingHours", b =>
373
-                {
374
-                    b.Property<int>("Id")
375
-                        .ValueGeneratedOnAdd()
376
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
377
-
378
-                    b.Property<bool>("Closed");
379
-
380
-                    b.Property<DateTime>("ClosingTime");
381
-
382
-                    b.Property<DateTime>("Created");
383
-
384
-                    b.Property<string>("Description");
385
-
386
-                    b.Property<bool>("IsDeleted");
387
-
388
-                    b.Property<DateTime>("Modified");
389
-
390
-                    b.Property<string>("ModifiedBy");
391
-
392
-                    b.Property<bool>("Opened24H");
393
-
394
-                    b.Property<DateTime>("OpeningTime");
395
-
396
-                    b.Property<int>("RestaurantId");
397
-
398
-                    b.HasKey("Id");
399
-
400
-                    b.HasIndex("RestaurantId");
401
-
402
-                    b.ToTable("TradingHours");
403
-                });
404
-
405
-            modelBuilder.Entity("ProRestaurant.Models.Accounts.DriverDetail", b =>
406
-                {
407
-                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
408
-                        .WithOne("DriverDetails")
409
-                        .HasForeignKey("ProRestaurant.Models.Accounts.DriverDetail", "UserId")
410
-                        .OnDelete(DeleteBehavior.Cascade);
411
-                });
412
-
413
-            modelBuilder.Entity("ProRestaurant.Models.Accounts.UserAddress", b =>
414
-                {
415
-                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
416
-                        .WithMany("Addresses")
417
-                        .HasForeignKey("UserId")
418
-                        .OnDelete(DeleteBehavior.Cascade);
419
-                });
420
-
421
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuCategory", b =>
422
-                {
423
-                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
424
-                        .WithMany()
425
-                        .HasForeignKey("RestaurantId")
426
-                        .OnDelete(DeleteBehavior.Cascade);
427
-                });
428
-
429
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuItem", b =>
430
-                {
431
-                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
432
-                        .WithMany()
433
-                        .HasForeignKey("RestaurantId")
434
-                        .OnDelete(DeleteBehavior.Cascade);
435
-                });
436
-
437
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuOption", b =>
438
-                {
439
-                    b.HasOne("ProRestaurant.Models.Restaurants.MenuCategory", "Category")
440
-                        .WithMany("Options")
441
-                        .HasForeignKey("CategoryId")
442
-                        .OnDelete(DeleteBehavior.Cascade);
443
-                });
444
-
445
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuOptionItem", b =>
446
-                {
447
-                    b.HasOne("ProRestaurant.Models.Restaurants.MenuOption", "MenuOption")
448
-                        .WithMany("Options")
449
-                        .HasForeignKey("MenuOptionId");
450
-                });
451
-
452
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUser", b =>
453
-                {
454
-                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
455
-                        .WithMany("Users")
456
-                        .HasForeignKey("RestaurantId")
457
-                        .OnDelete(DeleteBehavior.Cascade);
458
-
459
-                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
460
-                        .WithMany()
461
-                        .HasForeignKey("UserId")
462
-                        .OnDelete(DeleteBehavior.Cascade);
463
-                });
464
-
465
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.TradingHours", b =>
466
-                {
467
-                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
468
-                        .WithMany("TradingHours")
469
-                        .HasForeignKey("RestaurantId")
470
-                        .OnDelete(DeleteBehavior.Cascade);
471
-                });
472
-#pragma warning restore 612, 618
473
-        }
474
-    }
475
-}

+ 0
- 474
ProRestaurant/Migrations/20200703123907_MenuOption FK nullable to Category.Designer.cs Переглянути файл

@@ -1,474 +0,0 @@
1
-// <auto-generated />
2
-using System;
3
-using Microsoft.EntityFrameworkCore;
4
-using Microsoft.EntityFrameworkCore.Infrastructure;
5
-using Microsoft.EntityFrameworkCore.Metadata;
6
-using Microsoft.EntityFrameworkCore.Migrations;
7
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
8
-using ProRestaurant.DBContexts;
9
-
10
-namespace ProRestaurant.Migrations
11
-{
12
-    [DbContext(typeof(DBContext))]
13
-    [Migration("20200703123907_MenuOption FK nullable to Category")]
14
-    partial class MenuOptionFKnullabletoCategory
15
-    {
16
-        protected override void BuildTargetModel(ModelBuilder modelBuilder)
17
-        {
18
-#pragma warning disable 612, 618
19
-            modelBuilder
20
-                .HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
21
-                .HasAnnotation("Relational:MaxIdentifierLength", 128)
22
-                .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
23
-
24
-            modelBuilder.Entity("ProRestaurant.Models.Accounts.DriverDetail", b =>
25
-                {
26
-                    b.Property<int>("Id")
27
-                        .ValueGeneratedOnAdd()
28
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
29
-
30
-                    b.Property<DateTime>("Created");
31
-
32
-                    b.Property<bool>("IsDeleted");
33
-
34
-                    b.Property<DateTime>("Modified");
35
-
36
-                    b.Property<string>("ModifiedBy");
37
-
38
-                    b.Property<string>("Photo");
39
-
40
-                    b.Property<string>("RegistrationNumber");
41
-
42
-                    b.Property<int>("UserId");
43
-
44
-                    b.HasKey("Id");
45
-
46
-                    b.HasIndex("UserId")
47
-                        .IsUnique();
48
-
49
-                    b.ToTable("DriverDetails");
50
-                });
51
-
52
-            modelBuilder.Entity("ProRestaurant.Models.Accounts.User", b =>
53
-                {
54
-                    b.Property<int>("Id")
55
-                        .ValueGeneratedOnAdd()
56
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
57
-
58
-                    b.Property<string>("Cellphone");
59
-
60
-                    b.Property<DateTime>("Created");
61
-
62
-                    b.Property<string>("EmailAddress");
63
-
64
-                    b.Property<string>("FirstName");
65
-
66
-                    b.Property<bool>("IsDeleted");
67
-
68
-                    b.Property<DateTime>("Modified");
69
-
70
-                    b.Property<string>("ModifiedBy");
71
-
72
-                    b.Property<string>("Password");
73
-
74
-                    b.Property<string>("Surname");
75
-
76
-                    b.Property<int>("SystemRole");
77
-
78
-                    b.HasKey("Id");
79
-
80
-                    b.ToTable("Users");
81
-                });
82
-
83
-            modelBuilder.Entity("ProRestaurant.Models.Accounts.UserAddress", b =>
84
-                {
85
-                    b.Property<int>("Id")
86
-                        .ValueGeneratedOnAdd()
87
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
88
-
89
-                    b.Property<string>("City");
90
-
91
-                    b.Property<string>("ComplexName");
92
-
93
-                    b.Property<string>("Country");
94
-
95
-                    b.Property<DateTime>("Created");
96
-
97
-                    b.Property<string>("GoogleMapUrl");
98
-
99
-                    b.Property<bool>("IsComplex");
100
-
101
-                    b.Property<bool>("IsDefault");
102
-
103
-                    b.Property<bool>("IsDeleted");
104
-
105
-                    b.Property<decimal>("Latitude");
106
-
107
-                    b.Property<decimal>("Longitude");
108
-
109
-                    b.Property<DateTime>("Modified");
110
-
111
-                    b.Property<string>("ModifiedBy");
112
-
113
-                    b.Property<string>("PostalCode");
114
-
115
-                    b.Property<string>("Province");
116
-
117
-                    b.Property<string>("StreetName");
118
-
119
-                    b.Property<string>("StreetNumber");
120
-
121
-                    b.Property<string>("Suburb");
122
-
123
-                    b.Property<string>("UnitNumber");
124
-
125
-                    b.Property<int>("UserId");
126
-
127
-                    b.HasKey("Id");
128
-
129
-                    b.HasIndex("UserId");
130
-
131
-                    b.ToTable("UserAddresses");
132
-                });
133
-
134
-            modelBuilder.Entity("ProRestaurant.Models.Misc.Locations", b =>
135
-                {
136
-                    b.Property<int>("Id")
137
-                        .ValueGeneratedOnAdd()
138
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
139
-
140
-                    b.Property<string>("CategoryStore");
141
-
142
-                    b.Property<string>("ImageStore");
143
-
144
-                    b.HasKey("Id");
145
-
146
-                    b.ToTable("Locations");
147
-                });
148
-
149
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuCategory", b =>
150
-                {
151
-                    b.Property<int>("Id")
152
-                        .ValueGeneratedOnAdd()
153
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
154
-
155
-                    b.Property<DateTime>("Created");
156
-
157
-                    b.Property<string>("Description");
158
-
159
-                    b.Property<bool>("IsDeleted");
160
-
161
-                    b.Property<DateTime>("Modified");
162
-
163
-                    b.Property<string>("ModifiedBy");
164
-
165
-                    b.Property<int>("RestaurantId");
166
-
167
-                    b.HasKey("Id");
168
-
169
-                    b.HasIndex("RestaurantId");
170
-
171
-                    b.ToTable("MenuCategories");
172
-                });
173
-
174
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuItem", b =>
175
-                {
176
-                    b.Property<int>("Id")
177
-                        .ValueGeneratedOnAdd()
178
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
179
-
180
-                    b.Property<int>("CategoryId");
181
-
182
-                    b.Property<DateTime>("Created");
183
-
184
-                    b.Property<string>("Description");
185
-
186
-                    b.Property<string>("Image");
187
-
188
-                    b.Property<bool>("IsDeleted");
189
-
190
-                    b.Property<DateTime>("Modified");
191
-
192
-                    b.Property<string>("ModifiedBy");
193
-
194
-                    b.Property<string>("Name");
195
-
196
-                    b.Property<bool>("OverrideOptions");
197
-
198
-                    b.Property<decimal>("Price");
199
-
200
-                    b.Property<int>("RestaurantId");
201
-
202
-                    b.HasKey("Id");
203
-
204
-                    b.HasIndex("RestaurantId");
205
-
206
-                    b.ToTable("MenuItems");
207
-                });
208
-
209
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuOption", b =>
210
-                {
211
-                    b.Property<int>("Id")
212
-                        .ValueGeneratedOnAdd()
213
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
214
-
215
-                    b.Property<int?>("CategoryId");
216
-
217
-                    b.Property<DateTime>("Created");
218
-
219
-                    b.Property<string>("Description");
220
-
221
-                    b.Property<bool>("IsBasePrice");
222
-
223
-                    b.Property<bool>("IsDeleted");
224
-
225
-                    b.Property<int>("MenuItemId");
226
-
227
-                    b.Property<DateTime>("Modified");
228
-
229
-                    b.Property<string>("ModifiedBy");
230
-
231
-                    b.Property<int>("OptionLimit");
232
-
233
-                    b.Property<int>("OptionType");
234
-
235
-                    b.Property<int>("Rank");
236
-
237
-                    b.HasKey("Id");
238
-
239
-                    b.HasIndex("CategoryId");
240
-
241
-                    b.ToTable("MenuOptions");
242
-                });
243
-
244
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuOptionItem", b =>
245
-                {
246
-                    b.Property<int>("Id")
247
-                        .ValueGeneratedOnAdd()
248
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
249
-
250
-                    b.Property<DateTime>("Created");
251
-
252
-                    b.Property<string>("Description");
253
-
254
-                    b.Property<bool>("IsDeleted");
255
-
256
-                    b.Property<int?>("MenuOptionId");
257
-
258
-                    b.Property<DateTime>("Modified");
259
-
260
-                    b.Property<string>("ModifiedBy");
261
-
262
-                    b.Property<decimal>("Price");
263
-
264
-                    b.Property<int>("Rank");
265
-
266
-                    b.HasKey("Id");
267
-
268
-                    b.HasIndex("MenuOptionId");
269
-
270
-                    b.ToTable("MenuOptionItems");
271
-                });
272
-
273
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.Restaurant", b =>
274
-                {
275
-                    b.Property<int>("Id")
276
-                        .ValueGeneratedOnAdd()
277
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
278
-
279
-                    b.Property<string>("Categories");
280
-
281
-                    b.Property<string>("City");
282
-
283
-                    b.Property<string>("Country");
284
-
285
-                    b.Property<DateTime>("Created");
286
-
287
-                    b.Property<decimal>("DeliveryFee");
288
-
289
-                    b.Property<decimal>("DeliveryRadius");
290
-
291
-                    b.Property<string>("DeliveryTime");
292
-
293
-                    b.Property<string>("GoogleMapUrl");
294
-
295
-                    b.Property<bool>("IsDeleted");
296
-
297
-                    b.Property<decimal>("Latitude");
298
-
299
-                    b.Property<string>("Logo");
300
-
301
-                    b.Property<decimal>("Longitude");
302
-
303
-                    b.Property<string>("MethodsOfPayment");
304
-
305
-                    b.Property<DateTime>("Modified");
306
-
307
-                    b.Property<string>("ModifiedBy");
308
-
309
-                    b.Property<string>("Name");
310
-
311
-                    b.Property<string>("PostalCode");
312
-
313
-                    b.Property<string>("Province");
314
-
315
-                    b.Property<string>("ShopNumber");
316
-
317
-                    b.Property<string>("ShoppingCentre");
318
-
319
-                    b.Property<string>("StreetName");
320
-
321
-                    b.Property<string>("StreetNumber");
322
-
323
-                    b.Property<string>("Suburb");
324
-
325
-                    b.HasKey("Id");
326
-
327
-                    b.ToTable("Restaurants");
328
-                });
329
-
330
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantCategory", b =>
331
-                {
332
-                    b.Property<int>("Id")
333
-                        .ValueGeneratedOnAdd()
334
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
335
-
336
-                    b.Property<string>("Description");
337
-
338
-                    b.Property<string>("Image");
339
-
340
-                    b.HasKey("Id");
341
-
342
-                    b.ToTable("RestaurantCategories");
343
-                });
344
-
345
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUser", b =>
346
-                {
347
-                    b.Property<int>("Id")
348
-                        .ValueGeneratedOnAdd()
349
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
350
-
351
-                    b.Property<DateTime>("Created");
352
-
353
-                    b.Property<bool>("IsDeleted");
354
-
355
-                    b.Property<DateTime>("Modified");
356
-
357
-                    b.Property<string>("ModifiedBy");
358
-
359
-                    b.Property<int>("RestaurantId");
360
-
361
-                    b.Property<int>("UserId");
362
-
363
-                    b.HasKey("Id");
364
-
365
-                    b.HasIndex("RestaurantId");
366
-
367
-                    b.HasIndex("UserId");
368
-
369
-                    b.ToTable("RestaurantUsers");
370
-                });
371
-
372
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.TradingHours", b =>
373
-                {
374
-                    b.Property<int>("Id")
375
-                        .ValueGeneratedOnAdd()
376
-                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
377
-
378
-                    b.Property<bool>("Closed");
379
-
380
-                    b.Property<DateTime>("ClosingTime");
381
-
382
-                    b.Property<DateTime>("Created");
383
-
384
-                    b.Property<string>("Description");
385
-
386
-                    b.Property<bool>("IsDeleted");
387
-
388
-                    b.Property<DateTime>("Modified");
389
-
390
-                    b.Property<string>("ModifiedBy");
391
-
392
-                    b.Property<bool>("Opened24H");
393
-
394
-                    b.Property<DateTime>("OpeningTime");
395
-
396
-                    b.Property<int>("RestaurantId");
397
-
398
-                    b.HasKey("Id");
399
-
400
-                    b.HasIndex("RestaurantId");
401
-
402
-                    b.ToTable("TradingHours");
403
-                });
404
-
405
-            modelBuilder.Entity("ProRestaurant.Models.Accounts.DriverDetail", b =>
406
-                {
407
-                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
408
-                        .WithOne("DriverDetails")
409
-                        .HasForeignKey("ProRestaurant.Models.Accounts.DriverDetail", "UserId")
410
-                        .OnDelete(DeleteBehavior.Cascade);
411
-                });
412
-
413
-            modelBuilder.Entity("ProRestaurant.Models.Accounts.UserAddress", b =>
414
-                {
415
-                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
416
-                        .WithMany("Addresses")
417
-                        .HasForeignKey("UserId")
418
-                        .OnDelete(DeleteBehavior.Cascade);
419
-                });
420
-
421
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuCategory", b =>
422
-                {
423
-                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
424
-                        .WithMany()
425
-                        .HasForeignKey("RestaurantId")
426
-                        .OnDelete(DeleteBehavior.Cascade);
427
-                });
428
-
429
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuItem", b =>
430
-                {
431
-                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
432
-                        .WithMany()
433
-                        .HasForeignKey("RestaurantId")
434
-                        .OnDelete(DeleteBehavior.Cascade);
435
-                });
436
-
437
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuOption", b =>
438
-                {
439
-                    b.HasOne("ProRestaurant.Models.Restaurants.MenuCategory", "Category")
440
-                        .WithMany("Options")
441
-                        .HasForeignKey("CategoryId");
442
-                });
443
-
444
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuOptionItem", b =>
445
-                {
446
-                    b.HasOne("ProRestaurant.Models.Restaurants.MenuOption", "MenuOption")
447
-                        .WithMany("Options")
448
-                        .HasForeignKey("MenuOptionId");
449
-                });
450
-
451
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUser", b =>
452
-                {
453
-                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
454
-                        .WithMany("Users")
455
-                        .HasForeignKey("RestaurantId")
456
-                        .OnDelete(DeleteBehavior.Cascade);
457
-
458
-                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
459
-                        .WithMany()
460
-                        .HasForeignKey("UserId")
461
-                        .OnDelete(DeleteBehavior.Cascade);
462
-                });
463
-
464
-            modelBuilder.Entity("ProRestaurant.Models.Restaurants.TradingHours", b =>
465
-                {
466
-                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
467
-                        .WithMany("TradingHours")
468
-                        .HasForeignKey("RestaurantId")
469
-                        .OnDelete(DeleteBehavior.Cascade);
470
-                });
471
-#pragma warning restore 612, 618
472
-        }
473
-    }
474
-}

+ 0
- 50
ProRestaurant/Migrations/20200703123907_MenuOption FK nullable to Category.cs Переглянути файл

@@ -1,50 +0,0 @@
1
-using Microsoft.EntityFrameworkCore.Migrations;
2
-
3
-namespace ProRestaurant.Migrations
4
-{
5
-    public partial class MenuOptionFKnullabletoCategory : Migration
6
-    {
7
-        protected override void Up(MigrationBuilder migrationBuilder)
8
-        {
9
-            migrationBuilder.DropForeignKey(
10
-                name: "FK_MenuOptions_MenuCategories_CategoryId",
11
-                table: "MenuOptions");
12
-
13
-            migrationBuilder.AlterColumn<int>(
14
-                name: "CategoryId",
15
-                table: "MenuOptions",
16
-                nullable: true,
17
-                oldClrType: typeof(int));
18
-
19
-            migrationBuilder.AddForeignKey(
20
-                name: "FK_MenuOptions_MenuCategories_CategoryId",
21
-                table: "MenuOptions",
22
-                column: "CategoryId",
23
-                principalTable: "MenuCategories",
24
-                principalColumn: "Id",
25
-                onDelete: ReferentialAction.Restrict);
26
-        }
27
-
28
-        protected override void Down(MigrationBuilder migrationBuilder)
29
-        {
30
-            migrationBuilder.DropForeignKey(
31
-                name: "FK_MenuOptions_MenuCategories_CategoryId",
32
-                table: "MenuOptions");
33
-
34
-            migrationBuilder.AlterColumn<int>(
35
-                name: "CategoryId",
36
-                table: "MenuOptions",
37
-                nullable: false,
38
-                oldClrType: typeof(int),
39
-                oldNullable: true);
40
-
41
-            migrationBuilder.AddForeignKey(
42
-                name: "FK_MenuOptions_MenuCategories_CategoryId",
43
-                table: "MenuOptions",
44
-                column: "CategoryId",
45
-                principalTable: "MenuCategories",
46
-                principalColumn: "Id",
47
-                onDelete: ReferentialAction.Cascade);
48
-        }
49
-    }
50
-}

+ 0
- 118
ProRestaurant/Migrations/20200703140940_Menu Options Change.cs Переглянути файл

@@ -1,118 +0,0 @@
1
-using Microsoft.EntityFrameworkCore.Migrations;
2
-
3
-namespace ProRestaurant.Migrations
4
-{
5
-    public partial class MenuOptionsChange : Migration
6
-    {
7
-        protected override void Up(MigrationBuilder migrationBuilder)
8
-        {
9
-            migrationBuilder.DropForeignKey(
10
-                name: "FK_MenuOptions_MenuCategories_CategoryId",
11
-                table: "MenuOptions");
12
-
13
-            migrationBuilder.DropIndex(
14
-                name: "IX_MenuOptions_CategoryId",
15
-                table: "MenuOptions");
16
-
17
-            migrationBuilder.AlterColumn<int>(
18
-                name: "CategoryId",
19
-                table: "MenuOptions",
20
-                nullable: false,
21
-                oldClrType: typeof(int),
22
-                oldNullable: true);
23
-
24
-            migrationBuilder.AddColumn<int>(
25
-                name: "MenuCategoryId",
26
-                table: "MenuOptions",
27
-                nullable: true);
28
-
29
-            migrationBuilder.AddColumn<int>(
30
-                name: "RestaurantId",
31
-                table: "MenuOptions",
32
-                nullable: false,
33
-                defaultValue: 0);
34
-
35
-            migrationBuilder.AddColumn<bool>(
36
-                name: "OutOfStock",
37
-                table: "MenuItems",
38
-                nullable: false,
39
-                defaultValue: false);
40
-
41
-            migrationBuilder.CreateIndex(
42
-                name: "IX_MenuOptions_MenuCategoryId",
43
-                table: "MenuOptions",
44
-                column: "MenuCategoryId");
45
-
46
-            migrationBuilder.CreateIndex(
47
-                name: "IX_MenuOptions_RestaurantId",
48
-                table: "MenuOptions",
49
-                column: "RestaurantId");
50
-
51
-            migrationBuilder.AddForeignKey(
52
-                name: "FK_MenuOptions_MenuCategories_MenuCategoryId",
53
-                table: "MenuOptions",
54
-                column: "MenuCategoryId",
55
-                principalTable: "MenuCategories",
56
-                principalColumn: "Id",
57
-                onDelete: ReferentialAction.Restrict);
58
-
59
-            migrationBuilder.AddForeignKey(
60
-                name: "FK_MenuOptions_Restaurants_RestaurantId",
61
-                table: "MenuOptions",
62
-                column: "RestaurantId",
63
-                principalTable: "Restaurants",
64
-                principalColumn: "Id",
65
-                onDelete: ReferentialAction.Cascade);
66
-        }
67
-
68
-        protected override void Down(MigrationBuilder migrationBuilder)
69
-        {
70
-            migrationBuilder.DropForeignKey(
71
-                name: "FK_MenuOptions_MenuCategories_MenuCategoryId",
72
-                table: "MenuOptions");
73
-
74
-            migrationBuilder.DropForeignKey(
75
-                name: "FK_MenuOptions_Restaurants_RestaurantId",
76
-                table: "MenuOptions");
77
-
78
-            migrationBuilder.DropIndex(
79
-                name: "IX_MenuOptions_MenuCategoryId",
80
-                table: "MenuOptions");
81
-
82
-            migrationBuilder.DropIndex(
83
-                name: "IX_MenuOptions_RestaurantId",
84
-                table: "MenuOptions");
85
-
86
-            migrationBuilder.DropColumn(
87
-                name: "MenuCategoryId",
88
-                table: "MenuOptions");
89
-
90
-            migrationBuilder.DropColumn(
91
-                name: "RestaurantId",
92
-                table: "MenuOptions");
93
-
94
-            migrationBuilder.DropColumn(
95
-                name: "OutOfStock",
96
-                table: "MenuItems");
97
-
98
-            migrationBuilder.AlterColumn<int>(
99
-                name: "CategoryId",
100
-                table: "MenuOptions",
101
-                nullable: true,
102
-                oldClrType: typeof(int));
103
-
104
-            migrationBuilder.CreateIndex(
105
-                name: "IX_MenuOptions_CategoryId",
106
-                table: "MenuOptions",
107
-                column: "CategoryId");
108
-
109
-            migrationBuilder.AddForeignKey(
110
-                name: "FK_MenuOptions_MenuCategories_CategoryId",
111
-                table: "MenuOptions",
112
-                column: "CategoryId",
113
-                principalTable: "MenuCategories",
114
-                principalColumn: "Id",
115
-                onDelete: ReferentialAction.Restrict);
116
-        }
117
-    }
118
-}

+ 0
- 23
ProRestaurant/Migrations/20200706125622_User add password flag.cs Переглянути файл

@@ -1,23 +0,0 @@
1
-using Microsoft.EntityFrameworkCore.Migrations;
2
-
3
-namespace ProRestaurant.Migrations
4
-{
5
-    public partial class Useraddpasswordflag : Migration
6
-    {
7
-        protected override void Up(MigrationBuilder migrationBuilder)
8
-        {
9
-            migrationBuilder.AddColumn<bool>(
10
-                name: "ChangePassword",
11
-                table: "Users",
12
-                nullable: false,
13
-                defaultValue: false);
14
-        }
15
-
16
-        protected override void Down(MigrationBuilder migrationBuilder)
17
-        {
18
-            migrationBuilder.DropColumn(
19
-                name: "ChangePassword",
20
-                table: "Users");
21
-        }
22
-    }
23
-}

ProRestaurant/Migrations/20200703140940_Menu Options Change.Designer.cs → ProRestaurant/Migrations/20200727164838_NewMigration.Designer.cs Переглянути файл

@@ -10,8 +10,8 @@ using ProRestaurant.DBContexts;
10 10
 namespace ProRestaurant.Migrations
11 11
 {
12 12
     [DbContext(typeof(DBContext))]
13
-    [Migration("20200703140940_Menu Options Change")]
14
-    partial class MenuOptionsChange
13
+    [Migration("20200727164838_NewMigration")]
14
+    partial class NewMigration
15 15
     {
16 16
         protected override void BuildTargetModel(ModelBuilder modelBuilder)
17 17
         {
@@ -57,6 +57,8 @@ namespace ProRestaurant.Migrations
57 57
 
58 58
                     b.Property<string>("Cellphone");
59 59
 
60
+                    b.Property<bool>("ChangePassword");
61
+
60 62
                     b.Property<DateTime>("Created");
61 63
 
62 64
                     b.Property<string>("EmailAddress");
@@ -350,6 +352,66 @@ namespace ProRestaurant.Migrations
350 352
                     b.ToTable("RestaurantCategories");
351 353
                 });
352 354
 
355
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantRole", b =>
356
+                {
357
+                    b.Property<int>("Id")
358
+                        .ValueGeneratedOnAdd()
359
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
360
+
361
+                    b.Property<DateTime>("Created");
362
+
363
+                    b.Property<bool>("IsDeleted");
364
+
365
+                    b.Property<DateTime>("Modified");
366
+
367
+                    b.Property<string>("ModifiedBy");
368
+
369
+                    b.Property<int>("RestaurantId");
370
+
371
+                    b.Property<string>("RoleName");
372
+
373
+                    b.HasKey("Id");
374
+
375
+                    b.HasIndex("RestaurantId");
376
+
377
+                    b.ToTable("RestaurantRoles");
378
+                });
379
+
380
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantRolePremission", b =>
381
+                {
382
+                    b.Property<int>("Id")
383
+                        .ValueGeneratedOnAdd()
384
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
385
+
386
+                    b.Property<bool>("Create");
387
+
388
+                    b.Property<DateTime>("Created");
389
+
390
+                    b.Property<bool>("Delete");
391
+
392
+                    b.Property<bool>("IsDeleted");
393
+
394
+                    b.Property<DateTime>("Modified");
395
+
396
+                    b.Property<string>("ModifiedBy");
397
+
398
+                    b.Property<bool>("Navigate");
399
+
400
+                    b.Property<bool>("Read");
401
+
402
+                    b.Property<int>("RoleId");
403
+
404
+                    b.Property<string>("Target");
405
+
406
+                    b.Property<bool>("Write");
407
+
408
+                    b.HasKey("Id");
409
+
410
+                    b.HasIndex("RoleId");
411
+
412
+                    b.ToTable("RestaurantRolePremissions");
413
+                });
414
+
353 415
             modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUser", b =>
354 416
                 {
355 417
                     b.Property<int>("Id")
@@ -377,6 +439,29 @@ namespace ProRestaurant.Migrations
377 439
                     b.ToTable("RestaurantUsers");
378 440
                 });
379 441
 
442
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUserRestaurantRole", b =>
443
+                {
444
+                    b.Property<int>("Id")
445
+                        .ValueGeneratedOnAdd()
446
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
447
+
448
+                    b.Property<DateTime>("Created");
449
+
450
+                    b.Property<bool>("IsDeleted");
451
+
452
+                    b.Property<DateTime>("Modified");
453
+
454
+                    b.Property<string>("ModifiedBy");
455
+
456
+                    b.Property<int?>("RestaurantRoleId");
457
+
458
+                    b.Property<int?>("RestaurantUserId");
459
+
460
+                    b.HasKey("Id");
461
+
462
+                    b.ToTable("RestaurantUserRestaurantRoles");
463
+                });
464
+
380 465
             modelBuilder.Entity("ProRestaurant.Models.Restaurants.TradingHours", b =>
381 466
                 {
382 467
                     b.Property<int>("Id")
@@ -461,6 +546,22 @@ namespace ProRestaurant.Migrations
461 546
                         .HasForeignKey("MenuOptionId");
462 547
                 });
463 548
 
549
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantRole", b =>
550
+                {
551
+                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
552
+                        .WithMany()
553
+                        .HasForeignKey("RestaurantId")
554
+                        .OnDelete(DeleteBehavior.Cascade);
555
+                });
556
+
557
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantRolePremission", b =>
558
+                {
559
+                    b.HasOne("ProRestaurant.Models.Restaurants.RestaurantRole", "Role")
560
+                        .WithMany("Permissions")
561
+                        .HasForeignKey("RoleId")
562
+                        .OnDelete(DeleteBehavior.Cascade);
563
+                });
564
+
464 565
             modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUser", b =>
465 566
                 {
466 567
                     b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")

ProRestaurant/Migrations/20200630140752_Recreate Database.cs → ProRestaurant/Migrations/20200727164838_NewMigration.cs Переглянути файл

@@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
4 4
 
5 5
 namespace ProRestaurant.Migrations
6 6
 {
7
-    public partial class RecreateDatabase : Migration
7
+    public partial class NewMigration : Migration
8 8
     {
9 9
         protected override void Up(MigrationBuilder migrationBuilder)
10 10
         {
@@ -60,7 +60,7 @@ namespace ProRestaurant.Migrations
60 60
                     StreetName = table.Column<string>(nullable: true),
61 61
                     Suburb = table.Column<string>(nullable: true),
62 62
                     City = table.Column<string>(nullable: true),
63
-                    Provice = table.Column<string>(nullable: true),
63
+                    Province = table.Column<string>(nullable: true),
64 64
                     Country = table.Column<string>(nullable: true),
65 65
                     PostalCode = table.Column<string>(nullable: true),
66 66
                     DeliveryTime = table.Column<string>(nullable: true),
@@ -71,6 +71,24 @@ namespace ProRestaurant.Migrations
71 71
                     table.PrimaryKey("PK_Restaurants", x => x.Id);
72 72
                 });
73 73
 
74
+            migrationBuilder.CreateTable(
75
+                name: "RestaurantUserRestaurantRoles",
76
+                columns: table => new
77
+                {
78
+                    Id = table.Column<int>(nullable: false)
79
+                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
80
+                    Created = table.Column<DateTime>(nullable: false),
81
+                    Modified = table.Column<DateTime>(nullable: false),
82
+                    ModifiedBy = table.Column<string>(nullable: true),
83
+                    IsDeleted = table.Column<bool>(nullable: false),
84
+                    RestaurantUserId = table.Column<int>(nullable: true),
85
+                    RestaurantRoleId = table.Column<int>(nullable: true)
86
+                },
87
+                constraints: table =>
88
+                {
89
+                    table.PrimaryKey("PK_RestaurantUserRestaurantRoles", x => x.Id);
90
+                });
91
+
74 92
             migrationBuilder.CreateTable(
75 93
                 name: "Users",
76 94
                 columns: table => new
@@ -86,7 +104,8 @@ namespace ProRestaurant.Migrations
86 104
                     FirstName = table.Column<string>(nullable: true),
87 105
                     Surname = table.Column<string>(nullable: true),
88 106
                     Cellphone = table.Column<string>(nullable: true),
89
-                    SystemRole = table.Column<int>(nullable: false)
107
+                    SystemRole = table.Column<int>(nullable: false),
108
+                    ChangePassword = table.Column<bool>(nullable: false)
90 109
                 },
91 110
                 constraints: table =>
92 111
                 {
@@ -132,7 +151,9 @@ namespace ProRestaurant.Migrations
132 151
                     Image = table.Column<string>(nullable: true),
133 152
                     Name = table.Column<string>(nullable: true),
134 153
                     Description = table.Column<string>(nullable: true),
135
-                    Price = table.Column<decimal>(nullable: false)
154
+                    Price = table.Column<decimal>(nullable: false),
155
+                    OverrideOptions = table.Column<bool>(nullable: false),
156
+                    OutOfStock = table.Column<bool>(nullable: false)
136 157
                 },
137 158
                 constraints: table =>
138 159
                 {
@@ -145,6 +166,30 @@ namespace ProRestaurant.Migrations
145 166
                         onDelete: ReferentialAction.Cascade);
146 167
                 });
147 168
 
169
+            migrationBuilder.CreateTable(
170
+                name: "RestaurantRoles",
171
+                columns: table => new
172
+                {
173
+                    Id = table.Column<int>(nullable: false)
174
+                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
175
+                    Created = table.Column<DateTime>(nullable: false),
176
+                    Modified = table.Column<DateTime>(nullable: false),
177
+                    ModifiedBy = table.Column<string>(nullable: true),
178
+                    IsDeleted = table.Column<bool>(nullable: false),
179
+                    RestaurantId = table.Column<int>(nullable: false),
180
+                    RoleName = table.Column<string>(nullable: true)
181
+                },
182
+                constraints: table =>
183
+                {
184
+                    table.PrimaryKey("PK_RestaurantRoles", x => x.Id);
185
+                    table.ForeignKey(
186
+                        name: "FK_RestaurantRoles_Restaurants_RestaurantId",
187
+                        column: x => x.RestaurantId,
188
+                        principalTable: "Restaurants",
189
+                        principalColumn: "Id",
190
+                        onDelete: ReferentialAction.Cascade);
191
+                });
192
+
148 193
             migrationBuilder.CreateTable(
149 194
                 name: "TradingHours",
150 195
                 columns: table => new
@@ -275,22 +320,59 @@ namespace ProRestaurant.Migrations
275 320
                     Modified = table.Column<DateTime>(nullable: false),
276 321
                     ModifiedBy = table.Column<string>(nullable: true),
277 322
                     IsDeleted = table.Column<bool>(nullable: false),
323
+                    RestaurantId = table.Column<int>(nullable: false),
278 324
                     CategoryId = table.Column<int>(nullable: false),
279 325
                     Description = table.Column<string>(nullable: true),
280 326
                     OptionType = table.Column<int>(nullable: false),
281 327
                     OptionLimit = table.Column<int>(nullable: false),
282 328
                     IsBasePrice = table.Column<bool>(nullable: false),
283 329
                     Rank = table.Column<int>(nullable: false),
284
-                    MenuItemId = table.Column<int>(nullable: false)
330
+                    MenuItemId = table.Column<int>(nullable: false),
331
+                    MenuCategoryId = table.Column<int>(nullable: true)
285 332
                 },
286 333
                 constraints: table =>
287 334
                 {
288 335
                     table.PrimaryKey("PK_MenuOptions", x => x.Id);
289 336
                     table.ForeignKey(
290
-                        name: "FK_MenuOptions_MenuCategories_CategoryId",
291
-                        column: x => x.CategoryId,
337
+                        name: "FK_MenuOptions_MenuCategories_MenuCategoryId",
338
+                        column: x => x.MenuCategoryId,
292 339
                         principalTable: "MenuCategories",
293 340
                         principalColumn: "Id",
341
+                        onDelete: ReferentialAction.Restrict);
342
+                    table.ForeignKey(
343
+                        name: "FK_MenuOptions_Restaurants_RestaurantId",
344
+                        column: x => x.RestaurantId,
345
+                        principalTable: "Restaurants",
346
+                        principalColumn: "Id",
347
+                        onDelete: ReferentialAction.Cascade);
348
+                });
349
+
350
+            migrationBuilder.CreateTable(
351
+                name: "RestaurantRolePremissions",
352
+                columns: table => new
353
+                {
354
+                    Id = table.Column<int>(nullable: false)
355
+                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
356
+                    Created = table.Column<DateTime>(nullable: false),
357
+                    Modified = table.Column<DateTime>(nullable: false),
358
+                    ModifiedBy = table.Column<string>(nullable: true),
359
+                    IsDeleted = table.Column<bool>(nullable: false),
360
+                    RoleId = table.Column<int>(nullable: false),
361
+                    Target = table.Column<string>(nullable: true),
362
+                    Navigate = table.Column<bool>(nullable: false),
363
+                    Create = table.Column<bool>(nullable: false),
364
+                    Read = table.Column<bool>(nullable: false),
365
+                    Write = table.Column<bool>(nullable: false),
366
+                    Delete = table.Column<bool>(nullable: false)
367
+                },
368
+                constraints: table =>
369
+                {
370
+                    table.PrimaryKey("PK_RestaurantRolePremissions", x => x.Id);
371
+                    table.ForeignKey(
372
+                        name: "FK_RestaurantRolePremissions_RestaurantRoles_RoleId",
373
+                        column: x => x.RoleId,
374
+                        principalTable: "RestaurantRoles",
375
+                        principalColumn: "Id",
294 376
                         onDelete: ReferentialAction.Cascade);
295 377
                 });
296 378
 
@@ -342,9 +424,24 @@ namespace ProRestaurant.Migrations
342 424
                 column: "MenuOptionId");
343 425
 
344 426
             migrationBuilder.CreateIndex(
345
-                name: "IX_MenuOptions_CategoryId",
427
+                name: "IX_MenuOptions_MenuCategoryId",
346 428
                 table: "MenuOptions",
347
-                column: "CategoryId");
429
+                column: "MenuCategoryId");
430
+
431
+            migrationBuilder.CreateIndex(
432
+                name: "IX_MenuOptions_RestaurantId",
433
+                table: "MenuOptions",
434
+                column: "RestaurantId");
435
+
436
+            migrationBuilder.CreateIndex(
437
+                name: "IX_RestaurantRolePremissions_RoleId",
438
+                table: "RestaurantRolePremissions",
439
+                column: "RoleId");
440
+
441
+            migrationBuilder.CreateIndex(
442
+                name: "IX_RestaurantRoles_RestaurantId",
443
+                table: "RestaurantRoles",
444
+                column: "RestaurantId");
348 445
 
349 446
             migrationBuilder.CreateIndex(
350 447
                 name: "IX_RestaurantUsers_RestaurantId",
@@ -384,6 +481,12 @@ namespace ProRestaurant.Migrations
384 481
             migrationBuilder.DropTable(
385 482
                 name: "RestaurantCategories");
386 483
 
484
+            migrationBuilder.DropTable(
485
+                name: "RestaurantRolePremissions");
486
+
487
+            migrationBuilder.DropTable(
488
+                name: "RestaurantUserRestaurantRoles");
489
+
387 490
             migrationBuilder.DropTable(
388 491
                 name: "RestaurantUsers");
389 492
 
@@ -396,6 +499,9 @@ namespace ProRestaurant.Migrations
396 499
             migrationBuilder.DropTable(
397 500
                 name: "MenuOptions");
398 501
 
502
+            migrationBuilder.DropTable(
503
+                name: "RestaurantRoles");
504
+
399 505
             migrationBuilder.DropTable(
400 506
                 name: "Users");
401 507
 

ProRestaurant/Migrations/20200706125622_User add password flag.Designer.cs → ProRestaurant/Migrations/20200728060700_colRename.Designer.cs Переглянути файл

@@ -10,8 +10,8 @@ using ProRestaurant.DBContexts;
10 10
 namespace ProRestaurant.Migrations
11 11
 {
12 12
     [DbContext(typeof(DBContext))]
13
-    [Migration("20200706125622_User add password flag")]
14
-    partial class Useraddpasswordflag
13
+    [Migration("20200728060700_colRename")]
14
+    partial class colRename
15 15
     {
16 16
         protected override void BuildTargetModel(ModelBuilder modelBuilder)
17 17
         {
@@ -352,6 +352,66 @@ namespace ProRestaurant.Migrations
352 352
                     b.ToTable("RestaurantCategories");
353 353
                 });
354 354
 
355
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantRole", b =>
356
+                {
357
+                    b.Property<int>("Id")
358
+                        .ValueGeneratedOnAdd()
359
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
360
+
361
+                    b.Property<DateTime>("Created");
362
+
363
+                    b.Property<bool>("IsDeleted");
364
+
365
+                    b.Property<DateTime>("Modified");
366
+
367
+                    b.Property<string>("ModifiedBy");
368
+
369
+                    b.Property<int>("RestaurantId");
370
+
371
+                    b.Property<string>("RoleName");
372
+
373
+                    b.HasKey("Id");
374
+
375
+                    b.HasIndex("RestaurantId");
376
+
377
+                    b.ToTable("RestaurantRoles");
378
+                });
379
+
380
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantRolePremission", b =>
381
+                {
382
+                    b.Property<int>("Id")
383
+                        .ValueGeneratedOnAdd()
384
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
385
+
386
+                    b.Property<bool>("Create");
387
+
388
+                    b.Property<DateTime>("Created");
389
+
390
+                    b.Property<bool>("Delete");
391
+
392
+                    b.Property<bool>("IsDeleted");
393
+
394
+                    b.Property<DateTime>("Modified");
395
+
396
+                    b.Property<string>("ModifiedBy");
397
+
398
+                    b.Property<bool>("Navigate");
399
+
400
+                    b.Property<bool>("Read");
401
+
402
+                    b.Property<int>("RoleId");
403
+
404
+                    b.Property<string>("Target");
405
+
406
+                    b.Property<bool>("Write");
407
+
408
+                    b.HasKey("Id");
409
+
410
+                    b.HasIndex("RoleId");
411
+
412
+                    b.ToTable("RestaurantRolePremissions");
413
+                });
414
+
355 415
             modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUser", b =>
356 416
                 {
357 417
                     b.Property<int>("Id")
@@ -379,6 +439,29 @@ namespace ProRestaurant.Migrations
379 439
                     b.ToTable("RestaurantUsers");
380 440
                 });
381 441
 
442
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUserRestaurantRole", b =>
443
+                {
444
+                    b.Property<int>("Id")
445
+                        .ValueGeneratedOnAdd()
446
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
447
+
448
+                    b.Property<DateTime>("Created");
449
+
450
+                    b.Property<bool>("IsDeleted");
451
+
452
+                    b.Property<DateTime>("Modified");
453
+
454
+                    b.Property<string>("ModifiedBy");
455
+
456
+                    b.Property<int?>("RestaurantRoleId");
457
+
458
+                    b.Property<int?>("UserId");
459
+
460
+                    b.HasKey("Id");
461
+
462
+                    b.ToTable("RestaurantUserRestaurantRoles");
463
+                });
464
+
382 465
             modelBuilder.Entity("ProRestaurant.Models.Restaurants.TradingHours", b =>
383 466
                 {
384 467
                     b.Property<int>("Id")
@@ -463,6 +546,22 @@ namespace ProRestaurant.Migrations
463 546
                         .HasForeignKey("MenuOptionId");
464 547
                 });
465 548
 
549
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantRole", b =>
550
+                {
551
+                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
552
+                        .WithMany()
553
+                        .HasForeignKey("RestaurantId")
554
+                        .OnDelete(DeleteBehavior.Cascade);
555
+                });
556
+
557
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantRolePremission", b =>
558
+                {
559
+                    b.HasOne("ProRestaurant.Models.Restaurants.RestaurantRole", "Role")
560
+                        .WithMany("Permissions")
561
+                        .HasForeignKey("RoleId")
562
+                        .OnDelete(DeleteBehavior.Cascade);
563
+                });
564
+
466 565
             modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUser", b =>
467 566
                 {
468 567
                     b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")

ProRestaurant/Migrations/20200703060514_Province Spelling fix.cs → ProRestaurant/Migrations/20200728060700_colRename.cs Переглянути файл

@@ -2,22 +2,22 @@
2 2
 
3 3
 namespace ProRestaurant.Migrations
4 4
 {
5
-    public partial class ProvinceSpellingfix : Migration
5
+    public partial class colRename : Migration
6 6
     {
7 7
         protected override void Up(MigrationBuilder migrationBuilder)
8 8
         {
9 9
             migrationBuilder.RenameColumn(
10
-                name: "Provice",
11
-                table: "Restaurants",
12
-                newName: "Province");
10
+                name: "RestaurantUserId",
11
+                table: "RestaurantUserRestaurantRoles",
12
+                newName: "UserId");
13 13
         }
14 14
 
15 15
         protected override void Down(MigrationBuilder migrationBuilder)
16 16
         {
17 17
             migrationBuilder.RenameColumn(
18
-                name: "Province",
19
-                table: "Restaurants",
20
-                newName: "Provice");
18
+                name: "UserId",
19
+                table: "RestaurantUserRestaurantRoles",
20
+                newName: "RestaurantUserId");
21 21
         }
22 22
     }
23 23
 }

+ 99
- 0
ProRestaurant/Migrations/DBContextModelSnapshot.cs Переглянути файл

@@ -350,6 +350,66 @@ namespace ProRestaurant.Migrations
350 350
                     b.ToTable("RestaurantCategories");
351 351
                 });
352 352
 
353
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantRole", b =>
354
+                {
355
+                    b.Property<int>("Id")
356
+                        .ValueGeneratedOnAdd()
357
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
358
+
359
+                    b.Property<DateTime>("Created");
360
+
361
+                    b.Property<bool>("IsDeleted");
362
+
363
+                    b.Property<DateTime>("Modified");
364
+
365
+                    b.Property<string>("ModifiedBy");
366
+
367
+                    b.Property<int>("RestaurantId");
368
+
369
+                    b.Property<string>("RoleName");
370
+
371
+                    b.HasKey("Id");
372
+
373
+                    b.HasIndex("RestaurantId");
374
+
375
+                    b.ToTable("RestaurantRoles");
376
+                });
377
+
378
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantRolePremission", b =>
379
+                {
380
+                    b.Property<int>("Id")
381
+                        .ValueGeneratedOnAdd()
382
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
383
+
384
+                    b.Property<bool>("Create");
385
+
386
+                    b.Property<DateTime>("Created");
387
+
388
+                    b.Property<bool>("Delete");
389
+
390
+                    b.Property<bool>("IsDeleted");
391
+
392
+                    b.Property<DateTime>("Modified");
393
+
394
+                    b.Property<string>("ModifiedBy");
395
+
396
+                    b.Property<bool>("Navigate");
397
+
398
+                    b.Property<bool>("Read");
399
+
400
+                    b.Property<int>("RoleId");
401
+
402
+                    b.Property<string>("Target");
403
+
404
+                    b.Property<bool>("Write");
405
+
406
+                    b.HasKey("Id");
407
+
408
+                    b.HasIndex("RoleId");
409
+
410
+                    b.ToTable("RestaurantRolePremissions");
411
+                });
412
+
353 413
             modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUser", b =>
354 414
                 {
355 415
                     b.Property<int>("Id")
@@ -377,6 +437,29 @@ namespace ProRestaurant.Migrations
377 437
                     b.ToTable("RestaurantUsers");
378 438
                 });
379 439
 
440
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUserRestaurantRole", b =>
441
+                {
442
+                    b.Property<int>("Id")
443
+                        .ValueGeneratedOnAdd()
444
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
445
+
446
+                    b.Property<DateTime>("Created");
447
+
448
+                    b.Property<bool>("IsDeleted");
449
+
450
+                    b.Property<DateTime>("Modified");
451
+
452
+                    b.Property<string>("ModifiedBy");
453
+
454
+                    b.Property<int?>("RestaurantRoleId");
455
+
456
+                    b.Property<int?>("UserId");
457
+
458
+                    b.HasKey("Id");
459
+
460
+                    b.ToTable("RestaurantUserRestaurantRoles");
461
+                });
462
+
380 463
             modelBuilder.Entity("ProRestaurant.Models.Restaurants.TradingHours", b =>
381 464
                 {
382 465
                     b.Property<int>("Id")
@@ -461,6 +544,22 @@ namespace ProRestaurant.Migrations
461 544
                         .HasForeignKey("MenuOptionId");
462 545
                 });
463 546
 
547
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantRole", b =>
548
+                {
549
+                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
550
+                        .WithMany()
551
+                        .HasForeignKey("RestaurantId")
552
+                        .OnDelete(DeleteBehavior.Cascade);
553
+                });
554
+
555
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantRolePremission", b =>
556
+                {
557
+                    b.HasOne("ProRestaurant.Models.Restaurants.RestaurantRole", "Role")
558
+                        .WithMany("Permissions")
559
+                        .HasForeignKey("RoleId")
560
+                        .OnDelete(DeleteBehavior.Cascade);
561
+                });
562
+
464 563
             modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUser", b =>
465 564
                 {
466 565
                     b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")

+ 20
- 0
ProRestaurant/Models/Restaurants/RestaurantRole.cs Переглянути файл

@@ -0,0 +1,20 @@
1
+using ProRestaurant.Models.Accounts;
2
+using System.Collections.Generic;
3
+using System.ComponentModel.DataAnnotations.Schema;
4
+
5
+namespace ProRestaurant.Models.Restaurants
6
+{
7
+    public class RestaurantRole : BaseObject
8
+    {        
9
+        [ForeignKey("Restaurant")]
10
+        public int RestaurantId { get; set; }
11
+        public string RoleName { get; set; }
12
+
13
+        public List<RestaurantRolePremission> Permissions { get; set; }
14
+
15
+        public virtual Restaurant Restaurant { get; set; }        
16
+
17
+        [NotMapped]
18
+        public List<User> Users { get; set; }
19
+    }
20
+}

+ 18
- 0
ProRestaurant/Models/Restaurants/RestaurantRolePremission.cs Переглянути файл

@@ -0,0 +1,18 @@
1
+using System.ComponentModel.DataAnnotations.Schema;
2
+
3
+namespace ProRestaurant.Models.Restaurants
4
+{
5
+    public class RestaurantRolePremission : BaseObject
6
+    {
7
+        [ForeignKey("Role")]
8
+        public int RoleId { get; set; }
9
+        public string Target { get; set; }
10
+        public bool Navigate { get; set; }
11
+        public bool Create { get; set; }
12
+        public bool Read { get; set; }
13
+        public bool Write { get; set; }
14
+        public bool Delete { get; set; }
15
+
16
+        public virtual RestaurantRole Role { get; set; }
17
+    }
18
+}

+ 11
- 1
ProRestaurant/Models/Restaurants/RestaurantUser.cs Переглянути файл

@@ -1,4 +1,5 @@
1 1
 using ProRestaurant.Models.Accounts;
2
+using System.Collections.Generic;
2 3
 using System.ComponentModel.DataAnnotations.Schema;
3 4
 
4 5
 namespace ProRestaurant.Models.Restaurants
@@ -11,6 +12,15 @@ namespace ProRestaurant.Models.Restaurants
11 12
         public int RestaurantId { get; set; }
12 13
 
13 14
         public virtual User User { get; set; }
14
-        public virtual Restaurant Restaurant { get; set; }
15
+        public virtual Restaurant Restaurant { get; set; } 
16
+        
17
+        [NotMapped]
18
+        public List<RestaurantRole> Roles { get; set; }
19
+    }    
20
+
21
+    public class RestaurantUserRestaurantRole : BaseObject
22
+    {
23
+        public int? UserId { get; set; }
24
+        public int? RestaurantRoleId { get; set; }        
15 25
     }
16 26
 }

+ 147
- 0
ProRestaurant/Repository/Restaurants/IRestaurantRoleRepository.cs Переглянути файл

@@ -0,0 +1,147 @@
1
+using Microsoft.EntityFrameworkCore;
2
+using ProRestaurant.DBContexts;
3
+using ProRestaurant.Models.Accounts;
4
+using ProRestaurant.Models.Restaurants;
5
+using System.Collections.Generic;
6
+using System.Linq;
7
+
8
+namespace ProRestaurant.Repository.Restaurants
9
+{
10
+    public interface IRestaurantRoleRepository
11
+    {
12
+        List<RestaurantRole> GetRoles(int restaurantId);
13
+        RestaurantRole GetRole(int id);
14
+        RestaurantRolePremission GetPremission(int id);
15
+        void Insert(RestaurantRole Role);
16
+        void Update(RestaurantRole Role);
17
+        void Delete(RestaurantRole Role);
18
+        void Save();
19
+    }
20
+
21
+    public class RestaurantRoleRepository : IRestaurantRoleRepository
22
+    {
23
+        private readonly DBContext dBContext;
24
+
25
+        public RestaurantRoleRepository(DBContext db)
26
+        {
27
+            dBContext = db;
28
+        }
29
+
30
+        public void Delete(RestaurantRole Role)
31
+        {
32
+            dBContext.Remove(Role);
33
+            Save();
34
+        }
35
+
36
+        public RestaurantRolePremission GetPremission(int id)
37
+        {
38
+            var prem = dBContext.RestaurantRolePremissions.Where(p => p.Id == id).FirstOrDefault();
39
+
40
+            if (prem == null)
41
+            {
42
+                prem = new RestaurantRolePremission();
43
+            }
44
+
45
+            return prem;
46
+        }
47
+
48
+        public RestaurantRole GetRole(int id)
49
+        {
50
+            var role = dBContext.RestaurantRoles.Include("Permissions").Where(r => r.Id == id).FirstOrDefault();
51
+
52
+            if (role == null)
53
+            {
54
+                role = new RestaurantRole
55
+                {
56
+                    Permissions = new List<RestaurantRolePremission>(),
57
+                    Users = new List<User>()
58
+                };
59
+            }
60
+            else
61
+            {
62
+                var userIDs = dBContext.RestaurantUserRestaurantRoles.Where(r => r.RestaurantRoleId == role.Id).Select(r => r.UserId).ToList();
63
+                role.Users = dBContext.Users.Where(u => userIDs.Contains(u.Id)).ToList();
64
+            }
65
+
66
+            return role;
67
+        }
68
+
69
+        public List<RestaurantRole> GetRoles(int restaurantId)
70
+        {
71
+            return dBContext.RestaurantRoles.Where(r => r.RestaurantId == restaurantId).ToList();
72
+        }
73
+
74
+        public void Insert(RestaurantRole Role)
75
+        {
76
+            var users = Role.Users;
77
+            Role.Users = null;
78
+
79
+            dBContext.Add(Role);
80
+            Save();
81
+
82
+            foreach (var user in users)
83
+            {
84
+                var userRole = new RestaurantUserRestaurantRole
85
+                {
86
+                    UserId = user.Id,
87
+                    RestaurantRoleId = Role.Id
88
+                };
89
+                dBContext.Add(userRole);
90
+            }
91
+            Save();
92
+        }
93
+
94
+        public void Save()
95
+        {
96
+            dBContext.SaveChanges();
97
+        }
98
+
99
+        public void Update(RestaurantRole Role)
100
+        {
101
+            var prems = Role.Permissions;
102
+            Role.Permissions = null;
103
+
104
+            var users = Role.Users;
105
+            Role.Users = null;
106
+
107
+            var usersList = dBContext.RestaurantUserRestaurantRoles.Where(r => r.RestaurantRoleId == Role.Id).Select(r => r.UserId).ToList();
108
+            var userObjectList = users.Select(u => u.Id).ToList();
109
+
110
+            foreach(var user in users)
111
+            {
112
+                if (!usersList.Contains(user.Id))
113
+                {
114
+                    var userRole = new RestaurantUserRestaurantRole
115
+                    {
116
+                        UserId = user.Id,
117
+                        RestaurantRoleId = Role.Id
118
+                    };
119
+                    dBContext.Add(userRole);
120
+                }
121
+            }
122
+
123
+            var remove = dBContext.RestaurantUserRestaurantRoles.Where(r => r.RestaurantRoleId == Role.Id && !userObjectList.Contains(r.UserId.Value)).ToList();
124
+            foreach (var rem in remove)
125
+            {
126
+                dBContext.Remove(rem);
127
+            }
128
+            
129
+
130
+            foreach (var prem in prems)
131
+            {
132
+                if (prem.Id == 0)
133
+                {
134
+                    prem.RoleId = Role.Id;
135
+                    dBContext.Add(prem);
136
+                }
137
+                else
138
+                {
139
+                    dBContext.Entry(prem).State = EntityState.Modified;
140
+                }
141
+            }
142
+
143
+            dBContext.Entry(Role).State = EntityState.Modified;
144
+            Save();
145
+        }
146
+    }
147
+}

+ 3
- 9
ProRestaurant/Startup.cs Переглянути файл

@@ -1,25 +1,18 @@
1
-using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Text;
5
-using System.Threading.Tasks;
6
-using Microsoft.AspNetCore.Authentication.JwtBearer;
1
+using Microsoft.AspNetCore.Authentication.JwtBearer;
7 2
 using Microsoft.AspNetCore.Builder;
8 3
 using Microsoft.AspNetCore.Hosting;
9
-using Microsoft.AspNetCore.HttpsPolicy;
10 4
 using Microsoft.AspNetCore.Mvc;
11 5
 using Microsoft.AspNetCore.Mvc.Cors.Internal;
12 6
 using Microsoft.EntityFrameworkCore;
13 7
 using Microsoft.Extensions.Configuration;
14 8
 using Microsoft.Extensions.DependencyInjection;
15
-using Microsoft.Extensions.Logging;
16
-using Microsoft.Extensions.Options;
17 9
 using Microsoft.IdentityModel.Tokens;
18 10
 using Newtonsoft.Json;
19 11
 using ProRestaurant.Classes;
20 12
 using ProRestaurant.DBContexts;
21 13
 using ProRestaurant.Repository.Accounts;
22 14
 using ProRestaurant.Repository.Restaurants;
15
+using System.Text;
23 16
 
24 17
 namespace ProRestaurant
25 18
 {
@@ -86,6 +79,7 @@ namespace ProRestaurant
86 79
             services.AddTransient<IMenuItemRepository, MenuItemRepository>();
87 80
             services.AddTransient<IMenuRepository, MenuRepository>();
88 81
             services.AddTransient<IRestaurantUserRepository, RestaurantUserRepository>();
82
+            services.AddTransient<IRestaurantRoleRepository, RestaurantRoleRepository>();
89 83
 
90 84
             services.Configure<MvcOptions>(options =>
91 85
             {

+ 1
- 1
ProRestaurant/appsettings.json Переглянути файл

@@ -9,6 +9,6 @@
9 9
   },
10 10
   "AllowedHosts": "*",
11 11
   "ConnectionStrings": {
12
-    "DefaultDatabase": "Data Source=localhost;Initial Catalog=RestaurantDemo;Integrated Security=true;Pooling=false;"
12
+    "DefaultDatabase": "Data Source=localhost;Initial Catalog=RestaurantNew;Integrated Security=true;Pooling=false;"
13 13
   }
14 14
 }

BIN
ProRestaurant/bin/Debug/netcoreapp2.2/ProRestaurant.dll Переглянути файл


BIN
ProRestaurant/bin/Debug/netcoreapp2.2/ProRestaurant.pdb Переглянути файл


+ 1
- 1
ProRestaurant/bin/Debug/netcoreapp2.2/appsettings.json Переглянути файл

@@ -9,6 +9,6 @@
9 9
   },
10 10
   "AllowedHosts": "*",
11 11
   "ConnectionStrings": {
12
-    "DefaultDatabase": "Data Source=localhost;Initial Catalog=RestaurantDemo;Integrated Security=true;Pooling=false;"
12
+    "DefaultDatabase": "Data Source=localhost;Initial Catalog=RestaurantNew;Integrated Security=true;Pooling=false;"
13 13
   }
14 14
 }

+ 1
- 1
ProRestaurant/obj/Debug/netcoreapp2.2/ProRestaurant.csproj.CoreCompileInputs.cache Переглянути файл

@@ -1 +1 @@
1
-9adf305668e4c84bcd07601f8f7915e6185ed444
1
+0d33e6e40c82c46972d2120b49e55dfcc39b23a9

BIN
ProRestaurant/obj/Debug/netcoreapp2.2/ProRestaurant.csprojAssemblyReference.cache Переглянути файл


BIN
ProRestaurant/obj/Debug/netcoreapp2.2/ProRestaurant.dll Переглянути файл


BIN
ProRestaurant/obj/Debug/netcoreapp2.2/ProRestaurant.pdb Переглянути файл


Завантаження…
Відмінити
Зберегти