Quellcode durchsuchen

Super Admin - Listview pages

master
George Williams vor 4 Jahren
Ursprung
Commit
2014866f5f
24 geänderte Dateien mit 1401 neuen und 20 gelöschten Zeilen
  1. BIN
      .vs/ProRestaurant/DesignTimeBuild/.dtbcache.v2
  2. BIN
      .vs/ProRestaurant/v16/.suo
  3. 6
    0
      ProRestaurant/Controllers/Accounts/IUserController.cs
  4. 55
    0
      ProRestaurant/Controllers/Accounts/UserController.cs
  5. 0
    6
      ProRestaurant/Controllers/Restaurants/IRestaurantCategory.cs
  6. 6
    0
      ProRestaurant/Controllers/Restaurants/RestaurantController.cs
  7. 392
    0
      ProRestaurant/Migrations/20200611111141_005.Designer.cs
  8. 23
    0
      ProRestaurant/Migrations/20200611111141_005.cs
  9. 392
    0
      ProRestaurant/Migrations/20200611112655_006.Designer.cs
  10. 23
    0
      ProRestaurant/Migrations/20200611112655_006.cs
  11. 392
    0
      ProRestaurant/Migrations/20200611113345_007.Designer.cs
  12. 23
    0
      ProRestaurant/Migrations/20200611113345_007.cs
  13. 5
    3
      ProRestaurant/Migrations/DBContextModelSnapshot.cs
  14. 3
    2
      ProRestaurant/Models/Accounts/UserAddress.cs
  15. 66
    0
      ProRestaurant/Repository/Accounts/IUserRepository.cs
  16. 2
    1
      ProRestaurant/Repository/Restaurants/IRestaurantRepository.cs
  17. 6
    6
      ProRestaurant/Repository/Restaurants/RestaurantRepository.cs
  18. 6
    1
      ProRestaurant/Startup.cs
  19. BIN
      ProRestaurant/bin/Debug/netcoreapp2.2/ProRestaurant.dll
  20. BIN
      ProRestaurant/bin/Debug/netcoreapp2.2/ProRestaurant.pdb
  21. 1
    1
      ProRestaurant/obj/Debug/netcoreapp2.2/ProRestaurant.csproj.CoreCompileInputs.cache
  22. BIN
      ProRestaurant/obj/Debug/netcoreapp2.2/ProRestaurant.csprojAssemblyReference.cache
  23. BIN
      ProRestaurant/obj/Debug/netcoreapp2.2/ProRestaurant.dll
  24. BIN
      ProRestaurant/obj/Debug/netcoreapp2.2/ProRestaurant.pdb

BIN
.vs/ProRestaurant/DesignTimeBuild/.dtbcache.v2 Datei anzeigen


BIN
.vs/ProRestaurant/v16/.suo Datei anzeigen


+ 6
- 0
ProRestaurant/Controllers/Accounts/IUserController.cs Datei anzeigen

@@ -0,0 +1,6 @@
1
+namespace ProRestaurant.Controllers.Accounts
2
+{
3
+    internal interface IUserController
4
+    {
5
+    }
6
+}

+ 55
- 0
ProRestaurant/Controllers/Accounts/UserController.cs Datei anzeigen

@@ -0,0 +1,55 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Threading.Tasks;
5
+using System.Transactions;
6
+using Microsoft.AspNetCore.Mvc;
7
+using ProRestaurant.Models.Accounts;
8
+using ProRestaurant.Repository.Accounts;
9
+
10
+namespace ProRestaurant.Controllers.Accounts
11
+{
12
+    [Route("api/[controller]")]
13
+    [ApiController]
14
+    public class UserController : ControllerBase
15
+    {
16
+        private readonly IUserRepository repo;
17
+        public UserController(IUserRepository Repo)
18
+        {
19
+            repo = Repo;
20
+        }       
21
+
22
+        [HttpGet("GetCustomers")]
23
+        public IActionResult GetCustomers()
24
+        {
25
+            return new OkObjectResult(repo.Get(u => u.SystemRole == Classes.SystemRole.Customer));
26
+        }
27
+
28
+        [HttpGet("{id}")]
29
+        public IActionResult Get(int id)
30
+        {
31
+            return new OkObjectResult(repo.GetUser(id));
32
+        }
33
+
34
+        [HttpGet("GetUserAddress/{id}")]
35
+        public IActionResult GetUserAddress(int id)
36
+        {
37
+            return new OkObjectResult(repo.GetUserAddress(id));
38
+        }
39
+
40
+        [HttpPut]
41
+        public IActionResult Put([FromBody] User user)
42
+        {
43
+            if (user != null)
44
+            {
45
+                using (var scope = new TransactionScope())
46
+                {
47
+                    repo.Update(user);
48
+                    scope.Complete();
49
+                    return new OkResult();
50
+                }
51
+            }
52
+            return new NoContentResult();
53
+        }        
54
+    }
55
+}

+ 0
- 6
ProRestaurant/Controllers/Restaurants/IRestaurantCategory.cs Datei anzeigen

@@ -1,6 +0,0 @@
1
-namespace ProRestaurant.Controllers.Restaurants
2
-{
3
-    internal interface IRestaurantCategory
4
-    {
5
-    }
6
-}

+ 6
- 0
ProRestaurant/Controllers/Restaurants/RestaurantController.cs Datei anzeigen

@@ -16,6 +16,12 @@ namespace ProRestaurant.Controllers.Restaurants
16 16
             repo = _repo;
17 17
         }
18 18
 
19
+        [HttpGet("GetRestaurants")]
20
+        public IActionResult GetRestaurants()
21
+        {
22
+            return new OkObjectResult(repo.GetRestaurants());
23
+        }
24
+
19 25
         [HttpGet]
20 26
         public IActionResult Get()
21 27
         {

+ 392
- 0
ProRestaurant/Migrations/20200611111141_005.Designer.cs Datei anzeigen

@@ -0,0 +1,392 @@
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("20200611111141_005")]
14
+    partial class _005
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>("Provice");
116
+
117
+                    b.Property<string>("SteetNumber");
118
+
119
+                    b.Property<string>("StreetName");
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<decimal>("Price");
195
+
196
+                    b.Property<int>("RestaurantId");
197
+
198
+                    b.HasKey("Id");
199
+
200
+                    b.HasIndex("RestaurantId");
201
+
202
+                    b.ToTable("MenuItems");
203
+                });
204
+
205
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.Restaurant", b =>
206
+                {
207
+                    b.Property<int>("Id")
208
+                        .ValueGeneratedOnAdd()
209
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
210
+
211
+                    b.Property<string>("Categories");
212
+
213
+                    b.Property<string>("City");
214
+
215
+                    b.Property<string>("Country");
216
+
217
+                    b.Property<DateTime>("Created");
218
+
219
+                    b.Property<decimal>("DeliveryFee");
220
+
221
+                    b.Property<decimal>("DeliveryRadius");
222
+
223
+                    b.Property<string>("DeliveryTime");
224
+
225
+                    b.Property<string>("GoogleMapUrl");
226
+
227
+                    b.Property<bool>("IsDeleted");
228
+
229
+                    b.Property<decimal>("Latitude");
230
+
231
+                    b.Property<string>("Logo");
232
+
233
+                    b.Property<decimal>("Longitude");
234
+
235
+                    b.Property<string>("MethodsOfPayment");
236
+
237
+                    b.Property<DateTime>("Modified");
238
+
239
+                    b.Property<string>("ModifiedBy");
240
+
241
+                    b.Property<string>("Name");
242
+
243
+                    b.Property<string>("PostalCode");
244
+
245
+                    b.Property<string>("Provice");
246
+
247
+                    b.Property<string>("ShopNumber");
248
+
249
+                    b.Property<string>("ShoppingCentre");
250
+
251
+                    b.Property<string>("StreetName");
252
+
253
+                    b.Property<string>("StreetNumber");
254
+
255
+                    b.Property<string>("Suburb");
256
+
257
+                    b.HasKey("Id");
258
+
259
+                    b.ToTable("Restaurants");
260
+                });
261
+
262
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantCategory", b =>
263
+                {
264
+                    b.Property<int>("Id")
265
+                        .ValueGeneratedOnAdd()
266
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
267
+
268
+                    b.Property<string>("Description");
269
+
270
+                    b.Property<string>("Image");
271
+
272
+                    b.HasKey("Id");
273
+
274
+                    b.ToTable("RestaurantCategories");
275
+                });
276
+
277
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUser", b =>
278
+                {
279
+                    b.Property<int>("Id")
280
+                        .ValueGeneratedOnAdd()
281
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
282
+
283
+                    b.Property<DateTime>("Created");
284
+
285
+                    b.Property<bool>("IsDeleted");
286
+
287
+                    b.Property<DateTime>("Modified");
288
+
289
+                    b.Property<string>("ModifiedBy");
290
+
291
+                    b.Property<int>("RestaurantId");
292
+
293
+                    b.Property<int>("UserId");
294
+
295
+                    b.HasKey("Id");
296
+
297
+                    b.HasIndex("RestaurantId");
298
+
299
+                    b.HasIndex("UserId");
300
+
301
+                    b.ToTable("RestaurantUsers");
302
+                });
303
+
304
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.TradingHours", b =>
305
+                {
306
+                    b.Property<int>("Id")
307
+                        .ValueGeneratedOnAdd()
308
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
309
+
310
+                    b.Property<bool>("Closed");
311
+
312
+                    b.Property<DateTime>("ClosingTime");
313
+
314
+                    b.Property<DateTime>("Created");
315
+
316
+                    b.Property<string>("Description");
317
+
318
+                    b.Property<bool>("IsDeleted");
319
+
320
+                    b.Property<DateTime>("Modified");
321
+
322
+                    b.Property<string>("ModifiedBy");
323
+
324
+                    b.Property<bool>("Opened24H");
325
+
326
+                    b.Property<DateTime>("OpeningTime");
327
+
328
+                    b.Property<int>("RestaurantId");
329
+
330
+                    b.HasKey("Id");
331
+
332
+                    b.HasIndex("RestaurantId");
333
+
334
+                    b.ToTable("TradingHours");
335
+                });
336
+
337
+            modelBuilder.Entity("ProRestaurant.Models.Accounts.DriverDetail", b =>
338
+                {
339
+                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
340
+                        .WithOne("DriverDetails")
341
+                        .HasForeignKey("ProRestaurant.Models.Accounts.DriverDetail", "UserId")
342
+                        .OnDelete(DeleteBehavior.Cascade);
343
+                });
344
+
345
+            modelBuilder.Entity("ProRestaurant.Models.Accounts.UserAddress", b =>
346
+                {
347
+                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
348
+                        .WithMany("Addresses")
349
+                        .HasForeignKey("UserId")
350
+                        .OnDelete(DeleteBehavior.Cascade);
351
+                });
352
+
353
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuCategory", b =>
354
+                {
355
+                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
356
+                        .WithMany()
357
+                        .HasForeignKey("RestaurantId")
358
+                        .OnDelete(DeleteBehavior.Cascade);
359
+                });
360
+
361
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuItem", b =>
362
+                {
363
+                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
364
+                        .WithMany()
365
+                        .HasForeignKey("RestaurantId")
366
+                        .OnDelete(DeleteBehavior.Cascade);
367
+                });
368
+
369
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUser", b =>
370
+                {
371
+                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
372
+                        .WithMany("Users")
373
+                        .HasForeignKey("RestaurantId")
374
+                        .OnDelete(DeleteBehavior.Cascade);
375
+
376
+                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
377
+                        .WithMany()
378
+                        .HasForeignKey("UserId")
379
+                        .OnDelete(DeleteBehavior.Cascade);
380
+                });
381
+
382
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.TradingHours", b =>
383
+                {
384
+                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
385
+                        .WithMany("TradingHours")
386
+                        .HasForeignKey("RestaurantId")
387
+                        .OnDelete(DeleteBehavior.Cascade);
388
+                });
389
+#pragma warning restore 612, 618
390
+        }
391
+    }
392
+}

+ 23
- 0
ProRestaurant/Migrations/20200611111141_005.cs Datei anzeigen

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

+ 392
- 0
ProRestaurant/Migrations/20200611112655_006.Designer.cs Datei anzeigen

@@ -0,0 +1,392 @@
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("20200611112655_006")]
14
+    partial class _006
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>("SteetNumber");
118
+
119
+                    b.Property<string>("StreetName");
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<decimal>("Price");
195
+
196
+                    b.Property<int>("RestaurantId");
197
+
198
+                    b.HasKey("Id");
199
+
200
+                    b.HasIndex("RestaurantId");
201
+
202
+                    b.ToTable("MenuItems");
203
+                });
204
+
205
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.Restaurant", b =>
206
+                {
207
+                    b.Property<int>("Id")
208
+                        .ValueGeneratedOnAdd()
209
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
210
+
211
+                    b.Property<string>("Categories");
212
+
213
+                    b.Property<string>("City");
214
+
215
+                    b.Property<string>("Country");
216
+
217
+                    b.Property<DateTime>("Created");
218
+
219
+                    b.Property<decimal>("DeliveryFee");
220
+
221
+                    b.Property<decimal>("DeliveryRadius");
222
+
223
+                    b.Property<string>("DeliveryTime");
224
+
225
+                    b.Property<string>("GoogleMapUrl");
226
+
227
+                    b.Property<bool>("IsDeleted");
228
+
229
+                    b.Property<decimal>("Latitude");
230
+
231
+                    b.Property<string>("Logo");
232
+
233
+                    b.Property<decimal>("Longitude");
234
+
235
+                    b.Property<string>("MethodsOfPayment");
236
+
237
+                    b.Property<DateTime>("Modified");
238
+
239
+                    b.Property<string>("ModifiedBy");
240
+
241
+                    b.Property<string>("Name");
242
+
243
+                    b.Property<string>("PostalCode");
244
+
245
+                    b.Property<string>("Provice");
246
+
247
+                    b.Property<string>("ShopNumber");
248
+
249
+                    b.Property<string>("ShoppingCentre");
250
+
251
+                    b.Property<string>("StreetName");
252
+
253
+                    b.Property<string>("StreetNumber");
254
+
255
+                    b.Property<string>("Suburb");
256
+
257
+                    b.HasKey("Id");
258
+
259
+                    b.ToTable("Restaurants");
260
+                });
261
+
262
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantCategory", b =>
263
+                {
264
+                    b.Property<int>("Id")
265
+                        .ValueGeneratedOnAdd()
266
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
267
+
268
+                    b.Property<string>("Description");
269
+
270
+                    b.Property<string>("Image");
271
+
272
+                    b.HasKey("Id");
273
+
274
+                    b.ToTable("RestaurantCategories");
275
+                });
276
+
277
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUser", b =>
278
+                {
279
+                    b.Property<int>("Id")
280
+                        .ValueGeneratedOnAdd()
281
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
282
+
283
+                    b.Property<DateTime>("Created");
284
+
285
+                    b.Property<bool>("IsDeleted");
286
+
287
+                    b.Property<DateTime>("Modified");
288
+
289
+                    b.Property<string>("ModifiedBy");
290
+
291
+                    b.Property<int>("RestaurantId");
292
+
293
+                    b.Property<int>("UserId");
294
+
295
+                    b.HasKey("Id");
296
+
297
+                    b.HasIndex("RestaurantId");
298
+
299
+                    b.HasIndex("UserId");
300
+
301
+                    b.ToTable("RestaurantUsers");
302
+                });
303
+
304
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.TradingHours", b =>
305
+                {
306
+                    b.Property<int>("Id")
307
+                        .ValueGeneratedOnAdd()
308
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
309
+
310
+                    b.Property<bool>("Closed");
311
+
312
+                    b.Property<DateTime>("ClosingTime");
313
+
314
+                    b.Property<DateTime>("Created");
315
+
316
+                    b.Property<string>("Description");
317
+
318
+                    b.Property<bool>("IsDeleted");
319
+
320
+                    b.Property<DateTime>("Modified");
321
+
322
+                    b.Property<string>("ModifiedBy");
323
+
324
+                    b.Property<bool>("Opened24H");
325
+
326
+                    b.Property<DateTime>("OpeningTime");
327
+
328
+                    b.Property<int>("RestaurantId");
329
+
330
+                    b.HasKey("Id");
331
+
332
+                    b.HasIndex("RestaurantId");
333
+
334
+                    b.ToTable("TradingHours");
335
+                });
336
+
337
+            modelBuilder.Entity("ProRestaurant.Models.Accounts.DriverDetail", b =>
338
+                {
339
+                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
340
+                        .WithOne("DriverDetails")
341
+                        .HasForeignKey("ProRestaurant.Models.Accounts.DriverDetail", "UserId")
342
+                        .OnDelete(DeleteBehavior.Cascade);
343
+                });
344
+
345
+            modelBuilder.Entity("ProRestaurant.Models.Accounts.UserAddress", b =>
346
+                {
347
+                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
348
+                        .WithMany("Addresses")
349
+                        .HasForeignKey("UserId")
350
+                        .OnDelete(DeleteBehavior.Cascade);
351
+                });
352
+
353
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuCategory", b =>
354
+                {
355
+                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
356
+                        .WithMany()
357
+                        .HasForeignKey("RestaurantId")
358
+                        .OnDelete(DeleteBehavior.Cascade);
359
+                });
360
+
361
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuItem", b =>
362
+                {
363
+                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
364
+                        .WithMany()
365
+                        .HasForeignKey("RestaurantId")
366
+                        .OnDelete(DeleteBehavior.Cascade);
367
+                });
368
+
369
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUser", b =>
370
+                {
371
+                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
372
+                        .WithMany("Users")
373
+                        .HasForeignKey("RestaurantId")
374
+                        .OnDelete(DeleteBehavior.Cascade);
375
+
376
+                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
377
+                        .WithMany()
378
+                        .HasForeignKey("UserId")
379
+                        .OnDelete(DeleteBehavior.Cascade);
380
+                });
381
+
382
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.TradingHours", b =>
383
+                {
384
+                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
385
+                        .WithMany("TradingHours")
386
+                        .HasForeignKey("RestaurantId")
387
+                        .OnDelete(DeleteBehavior.Cascade);
388
+                });
389
+#pragma warning restore 612, 618
390
+        }
391
+    }
392
+}

+ 23
- 0
ProRestaurant/Migrations/20200611112655_006.cs Datei anzeigen

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

+ 392
- 0
ProRestaurant/Migrations/20200611113345_007.Designer.cs Datei anzeigen

@@ -0,0 +1,392 @@
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("20200611113345_007")]
14
+    partial class _007
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<decimal>("Price");
195
+
196
+                    b.Property<int>("RestaurantId");
197
+
198
+                    b.HasKey("Id");
199
+
200
+                    b.HasIndex("RestaurantId");
201
+
202
+                    b.ToTable("MenuItems");
203
+                });
204
+
205
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.Restaurant", b =>
206
+                {
207
+                    b.Property<int>("Id")
208
+                        .ValueGeneratedOnAdd()
209
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
210
+
211
+                    b.Property<string>("Categories");
212
+
213
+                    b.Property<string>("City");
214
+
215
+                    b.Property<string>("Country");
216
+
217
+                    b.Property<DateTime>("Created");
218
+
219
+                    b.Property<decimal>("DeliveryFee");
220
+
221
+                    b.Property<decimal>("DeliveryRadius");
222
+
223
+                    b.Property<string>("DeliveryTime");
224
+
225
+                    b.Property<string>("GoogleMapUrl");
226
+
227
+                    b.Property<bool>("IsDeleted");
228
+
229
+                    b.Property<decimal>("Latitude");
230
+
231
+                    b.Property<string>("Logo");
232
+
233
+                    b.Property<decimal>("Longitude");
234
+
235
+                    b.Property<string>("MethodsOfPayment");
236
+
237
+                    b.Property<DateTime>("Modified");
238
+
239
+                    b.Property<string>("ModifiedBy");
240
+
241
+                    b.Property<string>("Name");
242
+
243
+                    b.Property<string>("PostalCode");
244
+
245
+                    b.Property<string>("Provice");
246
+
247
+                    b.Property<string>("ShopNumber");
248
+
249
+                    b.Property<string>("ShoppingCentre");
250
+
251
+                    b.Property<string>("StreetName");
252
+
253
+                    b.Property<string>("StreetNumber");
254
+
255
+                    b.Property<string>("Suburb");
256
+
257
+                    b.HasKey("Id");
258
+
259
+                    b.ToTable("Restaurants");
260
+                });
261
+
262
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantCategory", b =>
263
+                {
264
+                    b.Property<int>("Id")
265
+                        .ValueGeneratedOnAdd()
266
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
267
+
268
+                    b.Property<string>("Description");
269
+
270
+                    b.Property<string>("Image");
271
+
272
+                    b.HasKey("Id");
273
+
274
+                    b.ToTable("RestaurantCategories");
275
+                });
276
+
277
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUser", b =>
278
+                {
279
+                    b.Property<int>("Id")
280
+                        .ValueGeneratedOnAdd()
281
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
282
+
283
+                    b.Property<DateTime>("Created");
284
+
285
+                    b.Property<bool>("IsDeleted");
286
+
287
+                    b.Property<DateTime>("Modified");
288
+
289
+                    b.Property<string>("ModifiedBy");
290
+
291
+                    b.Property<int>("RestaurantId");
292
+
293
+                    b.Property<int>("UserId");
294
+
295
+                    b.HasKey("Id");
296
+
297
+                    b.HasIndex("RestaurantId");
298
+
299
+                    b.HasIndex("UserId");
300
+
301
+                    b.ToTable("RestaurantUsers");
302
+                });
303
+
304
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.TradingHours", b =>
305
+                {
306
+                    b.Property<int>("Id")
307
+                        .ValueGeneratedOnAdd()
308
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
309
+
310
+                    b.Property<bool>("Closed");
311
+
312
+                    b.Property<DateTime>("ClosingTime");
313
+
314
+                    b.Property<DateTime>("Created");
315
+
316
+                    b.Property<string>("Description");
317
+
318
+                    b.Property<bool>("IsDeleted");
319
+
320
+                    b.Property<DateTime>("Modified");
321
+
322
+                    b.Property<string>("ModifiedBy");
323
+
324
+                    b.Property<bool>("Opened24H");
325
+
326
+                    b.Property<DateTime>("OpeningTime");
327
+
328
+                    b.Property<int>("RestaurantId");
329
+
330
+                    b.HasKey("Id");
331
+
332
+                    b.HasIndex("RestaurantId");
333
+
334
+                    b.ToTable("TradingHours");
335
+                });
336
+
337
+            modelBuilder.Entity("ProRestaurant.Models.Accounts.DriverDetail", b =>
338
+                {
339
+                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
340
+                        .WithOne("DriverDetails")
341
+                        .HasForeignKey("ProRestaurant.Models.Accounts.DriverDetail", "UserId")
342
+                        .OnDelete(DeleteBehavior.Cascade);
343
+                });
344
+
345
+            modelBuilder.Entity("ProRestaurant.Models.Accounts.UserAddress", b =>
346
+                {
347
+                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
348
+                        .WithMany("Addresses")
349
+                        .HasForeignKey("UserId")
350
+                        .OnDelete(DeleteBehavior.Cascade);
351
+                });
352
+
353
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuCategory", b =>
354
+                {
355
+                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
356
+                        .WithMany()
357
+                        .HasForeignKey("RestaurantId")
358
+                        .OnDelete(DeleteBehavior.Cascade);
359
+                });
360
+
361
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.MenuItem", b =>
362
+                {
363
+                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
364
+                        .WithMany()
365
+                        .HasForeignKey("RestaurantId")
366
+                        .OnDelete(DeleteBehavior.Cascade);
367
+                });
368
+
369
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.RestaurantUser", b =>
370
+                {
371
+                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
372
+                        .WithMany("Users")
373
+                        .HasForeignKey("RestaurantId")
374
+                        .OnDelete(DeleteBehavior.Cascade);
375
+
376
+                    b.HasOne("ProRestaurant.Models.Accounts.User", "User")
377
+                        .WithMany()
378
+                        .HasForeignKey("UserId")
379
+                        .OnDelete(DeleteBehavior.Cascade);
380
+                });
381
+
382
+            modelBuilder.Entity("ProRestaurant.Models.Restaurants.TradingHours", b =>
383
+                {
384
+                    b.HasOne("ProRestaurant.Models.Restaurants.Restaurant", "Restaurant")
385
+                        .WithMany("TradingHours")
386
+                        .HasForeignKey("RestaurantId")
387
+                        .OnDelete(DeleteBehavior.Cascade);
388
+                });
389
+#pragma warning restore 612, 618
390
+        }
391
+    }
392
+}

+ 23
- 0
ProRestaurant/Migrations/20200611113345_007.cs Datei anzeigen

@@ -0,0 +1,23 @@
1
+using Microsoft.EntityFrameworkCore.Migrations;
2
+
3
+namespace ProRestaurant.Migrations
4
+{
5
+    public partial class _007 : Migration
6
+    {
7
+        protected override void Up(MigrationBuilder migrationBuilder)
8
+        {
9
+            migrationBuilder.RenameColumn(
10
+                name: "SteetNumber",
11
+                table: "UserAddresses",
12
+                newName: "StreetNumber");
13
+        }
14
+
15
+        protected override void Down(MigrationBuilder migrationBuilder)
16
+        {
17
+            migrationBuilder.RenameColumn(
18
+                name: "StreetNumber",
19
+                table: "UserAddresses",
20
+                newName: "SteetNumber");
21
+        }
22
+    }
23
+}

+ 5
- 3
ProRestaurant/Migrations/DBContextModelSnapshot.cs Datei anzeigen

@@ -94,6 +94,8 @@ namespace ProRestaurant.Migrations
94 94
 
95 95
                     b.Property<string>("GoogleMapUrl");
96 96
 
97
+                    b.Property<bool>("IsComplex");
98
+
97 99
                     b.Property<bool>("IsDefault");
98 100
 
99 101
                     b.Property<bool>("IsDeleted");
@@ -108,12 +110,12 @@ namespace ProRestaurant.Migrations
108 110
 
109 111
                     b.Property<string>("PostalCode");
110 112
 
111
-                    b.Property<string>("Provice");
112
-
113
-                    b.Property<string>("SteetNumber");
113
+                    b.Property<string>("Province");
114 114
 
115 115
                     b.Property<string>("StreetName");
116 116
 
117
+                    b.Property<string>("StreetNumber");
118
+
117 119
                     b.Property<string>("Suburb");
118 120
 
119 121
                     b.Property<string>("UnitNumber");

+ 3
- 2
ProRestaurant/Models/Accounts/UserAddress.cs Datei anzeigen

@@ -4,17 +4,18 @@
4 4
     {
5 5
         public int UserId { get; set; }
6 6
         public bool IsDefault { get; set; }
7
+        public bool IsComplex { get; set; }
7 8
         public string GoogleMapUrl { get; set; }
8 9
         public decimal Latitude { get; set; }
9 10
         public decimal Longitude { get; set; } 
10 11
 
11 12
         public string UnitNumber { get; set; }
12 13
         public string ComplexName { get; set; }
13
-        public string SteetNumber { get; set; }
14
+        public string StreetNumber { get; set; }
14 15
         public string StreetName { get; set; }
15 16
         public string Suburb { get; set; }
16 17
         public string City { get; set; }
17
-        public string Provice { get; set; }
18
+        public string Province { get; set; }
18 19
         public string Country { get; set; }
19 20
         public string PostalCode { get; set; }
20 21
 

+ 66
- 0
ProRestaurant/Repository/Accounts/IUserRepository.cs Datei anzeigen

@@ -0,0 +1,66 @@
1
+using ProRestaurant.DBContexts;
2
+using ProRestaurant.Models.Accounts;
3
+using System;
4
+using System.Collections.Generic;
5
+using System.Linq;
6
+
7
+namespace ProRestaurant.Repository.Accounts
8
+{
9
+    public interface IUserRepository
10
+    {
11
+        ICollection<User> Get(Func<User, bool> where);
12
+        User GetUser(int UserId);
13
+        UserAddress GetUserAddress(int UserId);
14
+        void Update(User user);
15
+        void Save();
16
+    }
17
+
18
+    public class UserRepository : IUserRepository
19
+    {
20
+        private readonly DBContext dbContext;
21
+
22
+        public UserRepository(DBContext _db)
23
+        {
24
+            dbContext = _db;
25
+        }
26
+
27
+        public ICollection<User> Get(Func<User, bool> where)
28
+        {
29
+            return dbContext.Users.Where(where).ToList();
30
+        }
31
+
32
+        public User GetUser(int UserId)
33
+        {            
34
+            return dbContext.Users.Where(u => u.Id == UserId).FirstOrDefault();
35
+        }
36
+
37
+        public UserAddress GetUserAddress(int UserId)
38
+        {
39
+            var address = dbContext.UserAddresses.Where(a => a.UserId == UserId).FirstOrDefault();
40
+            return address;
41
+        }
42
+
43
+        public void Save()
44
+        {
45
+            dbContext.SaveChanges();
46
+        }
47
+
48
+        public void Update(User user)
49
+        {
50
+            if (user.Addresses != null && user.Addresses.Count > 0)
51
+            {
52
+                foreach(var address in user.Addresses)
53
+                {
54
+                    if (address.Id == 0)
55
+                    {
56
+                        dbContext.Add(address);
57
+                        Save();
58
+                    }
59
+                }
60
+            }
61
+
62
+            dbContext.Entry(user).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
63
+            Save();
64
+        }
65
+    }
66
+}

+ 2
- 1
ProRestaurant/Repository/Restaurants/IRestaurantRepository.cs Datei anzeigen

@@ -8,7 +8,8 @@ using System.Threading.Tasks;
8 8
 namespace ProRestaurant.Repository.Restaurants
9 9
 {
10 10
     public interface IRestaurantRepository
11
-    {        
11
+    {
12
+        List<Restaurant> GetRestaurants();
12 13
         List<RestaurantCard> GetSearch();
13 14
         Restaurant GetRestaurant(Func<Restaurant, bool> where);
14 15
         void Insert(Restaurant restaurant);

+ 6
- 6
ProRestaurant/Repository/Restaurants/RestaurantRepository.cs Datei anzeigen

@@ -23,11 +23,6 @@ namespace ProRestaurant.Repository.Restaurants
23 23
             return dBContext.Restaurants.Where(where).FirstOrDefault();
24 24
         }
25 25
 
26
-        public IEnumerable<Restaurant> GetRestaurants()
27
-        {
28
-            return dBContext.Restaurants.ToList();
29
-        }
30
-
31 26
         public List<RestaurantCard> GetSearch()
32 27
         {
33 28
             var restaurants = dBContext.Restaurants.ToList();
@@ -77,6 +72,11 @@ namespace ProRestaurant.Repository.Restaurants
77 72
         {
78 73
             dBContext.Entry(restaurant).State = EntityState.Modified;
79 74
             Save();
80
-        }        
75
+        }
76
+
77
+        List<Restaurant> IRestaurantRepository.GetRestaurants()
78
+        {
79
+            return dBContext.Restaurants.ToList();
80
+        }
81 81
     }
82 82
 }

+ 6
- 1
ProRestaurant/Startup.cs Datei anzeigen

@@ -71,12 +71,12 @@ namespace ProRestaurant
71 71
             services.AddScoped<IAuthenticateRepository, AuthenticateRepository>();
72 72
             #endregion
73 73
 
74
-
75 74
             services.AddDbContext<DBContext>(o => o.UseSqlServer(Configuration.GetConnectionString("DefaultDatabase")));           
76 75
 
77 76
             services.AddTransient<IRegistrationRepository, RegistrationRepository>();
78 77
             services.AddTransient<IRestaurantCategoryRepository, RestaurantCategoryRepository>();
79 78
             services.AddTransient<IRestaurantRepository, RestaurantRepository>();
79
+            services.AddTransient<IUserRepository, UserRepository>();
80 80
 
81 81
             services.Configure<MvcOptions>(options =>
82 82
             {
@@ -95,6 +95,11 @@ namespace ProRestaurant
95 95
                 app.UseHsts();
96 96
             }
97 97
 
98
+            app.UseCors(x => x
99
+                 .AllowAnyOrigin()
100
+                 .AllowAnyMethod()
101
+                 .AllowAnyHeader());
102
+            app.UseAuthentication();
98 103
             app.UseHttpsRedirection();
99 104
             app.UseMvc();
100 105
         }

BIN
ProRestaurant/bin/Debug/netcoreapp2.2/ProRestaurant.dll Datei anzeigen


BIN
ProRestaurant/bin/Debug/netcoreapp2.2/ProRestaurant.pdb Datei anzeigen


+ 1
- 1
ProRestaurant/obj/Debug/netcoreapp2.2/ProRestaurant.csproj.CoreCompileInputs.cache Datei anzeigen

@@ -1 +1 @@
1
-d43a7af6b2b5d7d9d5ce44deb53c19ad484cc2cc
1
+95f31759ff509a3473cf7dbab60f1f45eea8a8ac

BIN
ProRestaurant/obj/Debug/netcoreapp2.2/ProRestaurant.csprojAssemblyReference.cache Datei anzeigen


BIN
ProRestaurant/obj/Debug/netcoreapp2.2/ProRestaurant.dll Datei anzeigen


BIN
ProRestaurant/obj/Debug/netcoreapp2.2/ProRestaurant.pdb Datei anzeigen


Laden…
Abbrechen
Speichern