Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
payments
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
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
Юнусов Ибрагим
payments
Commits
0f55c8e6
Commit
0f55c8e6
authored
Jul 06, 2022
by
Юнусов Ибрагим
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил первичные данные через датасид
parent
9662b37a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
+75
-0
DataSeeder.cs
...ts/Payment.WebApi/Infrastructures/Databases/DataSeeder.cs
+75
-0
No files found.
Payments/Payment.WebApi/Infrastructures/Databases/DataSeeder.cs
0 → 100644
View file @
0f55c8e6
using
Microsoft.EntityFrameworkCore
;
using
Payment.WebApi.Models.DbModels
;
namespace
Payment.WebApi.Infrastructures.Databases
;
public
static
class
DataSeeder
{
public
static
void
SeedUser
(
this
ModelBuilder
builder
)
{
builder
.
Entity
<
User
>()
.
HasData
(
new
User
{
Id
=
1
,
Age
=
25
,
FirstName
=
"Jhon"
,
LastName
=
"Doe"
,
MiddleName
=
"Blastovich"
});
builder
.
Entity
<
User
>()
.
HasData
(
new
User
{
Id
=
2
,
Age
=
27
,
FirstName
=
"Jhoan"
,
LastName
=
"Shepard"
,
MiddleName
=
default
});
}
public
static
void
SeedUserBalance
(
this
ModelBuilder
builder
)
{
builder
.
Entity
<
UserBalance
>()
.
HasData
(
new
List
<
UserBalance
>
{
new
UserBalance
{
Id
=
1
,
Amount
=
100
,
Currency
=
"KZT"
,
UserId
=
1
},
new
UserBalance
{
Id
=
2
,
Amount
=
250
,
Currency
=
"KZT"
,
UserId
=
2
}
});
}
public
static
void
SeedSupplier
(
this
ModelBuilder
builder
)
{
builder
.
Entity
<
Supplier
>()
.
HasData
(
new
List
<
Supplier
>
{
new
Supplier
{
Id
=
1
,
Name
=
"Алсеко"
},
new
Supplier
{
Id
=
2
,
Name
=
"Казактелеком"
},
new
Supplier
{
Id
=
3
,
Name
=
"Beeline"
}
});
}
}
\ No newline at end of file
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