Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
Lesson49
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Пасько Виталий
Lesson49
Commits
fe443008
Commit
fe443008
authored
Aug 07, 2022
by
Пасько Виталий
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#3
Добавил сущность отзыва от пользователя.
parent
3351f367
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
548 additions
and
0 deletions
+548
-0
20220807164848_AddFeedbackEntity.Designer.cs
...e/Migrations/20220807164848_AddFeedbackEntity.Designer.cs
+437
-0
20220807164848_AddFeedbackEntity.cs
PhoneStore/Migrations/20220807164848_AddFeedbackEntity.cs
+54
-0
MobileContextModelSnapshot.cs
PhoneStore/Migrations/MobileContextModelSnapshot.cs
+44
-0
Feedback.cs
PhoneStore/Models/Feedback.cs
+12
-0
MobileContext.cs
PhoneStore/Models/MobileContext.cs
+1
-0
No files found.
PhoneStore/Migrations/20220807164848_AddFeedbackEntity.Designer.cs
0 → 100644
View file @
fe443008
This diff is collapsed.
Click to expand it.
PhoneStore/Migrations/20220807164848_AddFeedbackEntity.cs
0 → 100644
View file @
fe443008
using
Microsoft.EntityFrameworkCore.Migrations
;
using
Npgsql.EntityFrameworkCore.PostgreSQL.Metadata
;
namespace
PhoneStore.Migrations
{
public
partial
class
AddFeedbackEntity
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
CreateTable
(
name
:
"Feedbacks"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"integer"
,
nullable
:
false
)
.
Annotation
(
"Npgsql:ValueGenerationStrategy"
,
NpgsqlValueGenerationStrategy
.
IdentityByDefaultColumn
),
UserId
=
table
.
Column
<
int
>(
type
:
"integer"
,
nullable
:
false
),
PhoneId
=
table
.
Column
<
int
>(
type
:
"integer"
,
nullable
:
false
),
Text
=
table
.
Column
<
string
>(
type
:
"text"
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Feedbacks"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_Feedbacks_AspNetUsers_UserId"
,
column
:
x
=>
x
.
UserId
,
principalTable
:
"AspNetUsers"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
table
.
ForeignKey
(
name
:
"FK_Feedbacks_Phones_PhoneId"
,
column
:
x
=>
x
.
PhoneId
,
principalTable
:
"Phones"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
});
migrationBuilder
.
CreateIndex
(
name
:
"IX_Feedbacks_PhoneId"
,
table
:
"Feedbacks"
,
column
:
"PhoneId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Feedbacks_UserId"
,
table
:
"Feedbacks"
,
column
:
"UserId"
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropTable
(
name
:
"Feedbacks"
);
}
}
}
PhoneStore/Migrations/MobileContextModelSnapshot.cs
View file @
fe443008
...
...
@@ -152,6 +152,31 @@ namespace PhoneStore.Migrations
b
.
ToTable
(
"Brands"
);
});
modelBuilder
.
Entity
(
"PhoneStore.Models.Feedback"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"integer"
)
.
HasAnnotation
(
"Npgsql:ValueGenerationStrategy"
,
NpgsqlValueGenerationStrategy
.
IdentityByDefaultColumn
);
b
.
Property
<
int
>(
"PhoneId"
)
.
HasColumnType
(
"integer"
);
b
.
Property
<
string
>(
"Text"
)
.
HasColumnType
(
"text"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"integer"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"PhoneId"
);
b
.
HasIndex
(
"UserId"
);
b
.
ToTable
(
"Feedbacks"
);
});
modelBuilder
.
Entity
(
"PhoneStore.Models.Order"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
...
...
@@ -366,6 +391,25 @@ namespace PhoneStore.Migrations
b
.
Navigation
(
"Phone"
);
});
modelBuilder
.
Entity
(
"PhoneStore.Models.Feedback"
,
b
=>
{
b
.
HasOne
(
"PhoneStore.Models.Phone"
,
"Phone"
)
.
WithMany
()
.
HasForeignKey
(
"PhoneId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PhoneStore.Models.User"
,
"User"
)
.
WithMany
()
.
HasForeignKey
(
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Phone"
);
b
.
Navigation
(
"User"
);
});
modelBuilder
.
Entity
(
"PhoneStore.Models.Order"
,
b
=>
{
b
.
HasOne
(
"PhoneStore.Models.Phone"
,
"Phone"
)
...
...
PhoneStore/Models/Feedback.cs
0 → 100644
View file @
fe443008
namespace
PhoneStore.Models
{
public
class
Feedback
{
public
int
Id
{
get
;
set
;
}
public
int
UserId
{
get
;
set
;
}
public
int
PhoneId
{
get
;
set
;
}
public
string
Text
{
get
;
set
;
}
public
User
User
{
get
;
set
;
}
public
Phone
Phone
{
get
;
set
;
}
}
}
\ No newline at end of file
PhoneStore/Models/MobileContext.cs
View file @
fe443008
...
...
@@ -9,6 +9,7 @@ namespace PhoneStore.Models
public
DbSet
<
Order
>
Orders
{
get
;
set
;
}
public
DbSet
<
Basket
>
Baskets
{
get
;
set
;
}
public
DbSet
<
Brand
>
Brands
{
get
;
set
;
}
public
DbSet
<
Feedback
>
Feedbacks
{
get
;
set
;
}
public
MobileContext
(
DbContextOptions
<
MobileContext
>
options
)
:
base
(
options
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment