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
ec9df425
Commit
ec9df425
authored
Aug 07, 2022
by
Пасько Виталий
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#3
Добавил сущность отзыва о телефоне.
parent
fe443008
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
537 additions
and
3 deletions
+537
-3
PhonesController.cs
PhoneStore/Controllers/PhonesController.cs
+23
-2
20220807165430_AddCreationDateTimeField.Designer.cs
...tions/20220807165430_AddCreationDateTimeField.Designer.cs
+440
-0
20220807165430_AddCreationDateTimeField.cs
...ore/Migrations/20220807165430_AddCreationDateTimeField.cs
+25
-0
MobileContextModelSnapshot.cs
PhoneStore/Migrations/MobileContextModelSnapshot.cs
+3
-0
Feedback.cs
PhoneStore/Models/Feedback.cs
+3
-0
Phone.cs
PhoneStore/Models/Phone.cs
+3
-0
PhoneService.cs
PhoneStore/Services/PhoneService.cs
+0
-1
FeedbackCreateViewModel.cs
PhoneStore/ViewModels/FeedbackCreateViewModel.cs
+9
-0
FeedbackViewModel.cs
PhoneStore/ViewModels/FeedbackViewModel.cs
+16
-0
PhoneViewModel.cs
PhoneStore/ViewModels/PhoneViewModel.cs
+15
-0
No files found.
PhoneStore/Controllers/PhonesController.cs
View file @
ec9df425
...
@@ -142,11 +142,32 @@ namespace PhoneStore.Controllers
...
@@ -142,11 +142,32 @@ namespace PhoneStore.Controllers
if
(!
phoneId
.
HasValue
)
return
RedirectToAction
(
"Error"
,
"Errors"
,
new
{
statusCode
=
777
});
if
(!
phoneId
.
HasValue
)
return
RedirectToAction
(
"Error"
,
"Errors"
,
new
{
statusCode
=
777
});
var
phone
=
_db
.
Phones
var
phone
=
_db
.
Phones
.
Include
(
p
=>
p
.
Brand
)
.
Include
(
p
=>
p
.
Brand
)
.
Include
(
p
=>
p
.
Feedbacks
)
.
ThenInclude
(
f
=>
f
.
User
)
.
FirstOrDefault
(
p
=>
p
.
Id
==
phoneId
);
.
FirstOrDefault
(
p
=>
p
.
Id
==
phoneId
);
if
(
phone
is
null
)
if
(
phone
is
null
)
return
RedirectToAction
(
"Error"
,
"Errors"
,
new
{
statusCode
=
777
});
return
RedirectToAction
(
"Error"
,
"Errors"
,
new
{
statusCode
=
777
});
var
phoneViewModel
=
new
PhoneViewModel
return
View
(
phone
);
{
Brand
=
phone
.
Brand
,
Feedbacks
=
phone
.
Feedbacks
.
Select
(
f
=>
new
FeedbackViewModel
{
Id
=
f
.
Id
,
Phone
=
f
.
Phone
,
Text
=
f
.
Text
,
User
=
f
.
User
,
CreationDateTime
=
f
.
CreationDateTime
,
UserId
=
f
.
UserId
,
PhoneId
=
f
.
PhoneId
})
.
OrderByDescending
(
f
=>
f
.
CreationDateTime
)
.
ToList
(),
Image
=
phone
.
Image
,
Name
=
phone
.
Name
,
Price
=
phone
.
Price
,
Id
=
phone
.
Id
};
return
View
(
phoneViewModel
);
}
}
}
}
}
}
\ No newline at end of file
PhoneStore/Migrations/20220807165430_AddCreationDateTimeField.Designer.cs
0 → 100644
View file @
ec9df425
// <auto-generated />
using
System
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Infrastructure
;
using
Microsoft.EntityFrameworkCore.Migrations
;
using
Microsoft.EntityFrameworkCore.Storage.ValueConversion
;
using
Npgsql.EntityFrameworkCore.PostgreSQL.Metadata
;
using
PhoneStore.Models
;
namespace
PhoneStore.Migrations
{
[
DbContext
(
typeof
(
MobileContext
))]
[
Migration
(
"20220807165430_AddCreationDateTimeField"
)]
partial
class
AddCreationDateTimeField
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
63
)
.
HasAnnotation
(
"ProductVersion"
,
"5.0.17"
)
.
HasAnnotation
(
"Npgsql:ValueGenerationStrategy"
,
NpgsqlValueGenerationStrategy
.
IdentityByDefaultColumn
);
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"integer"
)
.
HasAnnotation
(
"Npgsql:ValueGenerationStrategy"
,
NpgsqlValueGenerationStrategy
.
IdentityByDefaultColumn
);
b
.
Property
<
string
>(
"ClaimType"
)
.
HasColumnType
(
"text"
);
b
.
Property
<
string
>(
"ClaimValue"
)
.
HasColumnType
(
"text"
);
b
.
Property
<
int
>(
"RoleId"
)
.
HasColumnType
(
"integer"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"RoleId"
);
b
.
ToTable
(
"AspNetRoleClaims"
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserClaim<int>"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"integer"
)
.
HasAnnotation
(
"Npgsql:ValueGenerationStrategy"
,
NpgsqlValueGenerationStrategy
.
IdentityByDefaultColumn
);
b
.
Property
<
string
>(
"ClaimType"
)
.
HasColumnType
(
"text"
);
b
.
Property
<
string
>(
"ClaimValue"
)
.
HasColumnType
(
"text"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"integer"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"UserId"
);
b
.
ToTable
(
"AspNetUserClaims"
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserLogin<int>"
,
b
=>
{
b
.
Property
<
string
>(
"LoginProvider"
)
.
HasColumnType
(
"text"
);
b
.
Property
<
string
>(
"ProviderKey"
)
.
HasColumnType
(
"text"
);
b
.
Property
<
string
>(
"ProviderDisplayName"
)
.
HasColumnType
(
"text"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"integer"
);
b
.
HasKey
(
"LoginProvider"
,
"ProviderKey"
);
b
.
HasIndex
(
"UserId"
);
b
.
ToTable
(
"AspNetUserLogins"
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserRole<int>"
,
b
=>
{
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"integer"
);
b
.
Property
<
int
>(
"RoleId"
)
.
HasColumnType
(
"integer"
);
b
.
HasKey
(
"UserId"
,
"RoleId"
);
b
.
HasIndex
(
"RoleId"
);
b
.
ToTable
(
"AspNetUserRoles"
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserToken<int>"
,
b
=>
{
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"integer"
);
b
.
Property
<
string
>(
"LoginProvider"
)
.
HasColumnType
(
"text"
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"text"
);
b
.
Property
<
string
>(
"Value"
)
.
HasColumnType
(
"text"
);
b
.
HasKey
(
"UserId"
,
"LoginProvider"
,
"Name"
);
b
.
ToTable
(
"AspNetUserTokens"
);
});
modelBuilder
.
Entity
(
"PhoneStore.Models.Basket"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"integer"
)
.
HasAnnotation
(
"Npgsql:ValueGenerationStrategy"
,
NpgsqlValueGenerationStrategy
.
IdentityByDefaultColumn
);
b
.
Property
<
int
>(
"PhoneId"
)
.
HasColumnType
(
"integer"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"PhoneId"
);
b
.
ToTable
(
"Baskets"
);
});
modelBuilder
.
Entity
(
"PhoneStore.Models.Brand"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"integer"
)
.
HasAnnotation
(
"Npgsql:ValueGenerationStrategy"
,
NpgsqlValueGenerationStrategy
.
IdentityByDefaultColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"text"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Brands"
);
});
modelBuilder
.
Entity
(
"PhoneStore.Models.Feedback"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"integer"
)
.
HasAnnotation
(
"Npgsql:ValueGenerationStrategy"
,
NpgsqlValueGenerationStrategy
.
IdentityByDefaultColumn
);
b
.
Property
<
DateTime
>(
"CreationDateTime"
)
.
HasColumnType
(
"timestamp without time zone"
);
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"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"integer"
)
.
HasAnnotation
(
"Npgsql:ValueGenerationStrategy"
,
NpgsqlValueGenerationStrategy
.
IdentityByDefaultColumn
);
b
.
Property
<
string
>(
"Address"
)
.
HasColumnType
(
"text"
);
b
.
Property
<
string
>(
"ContactPhone"
)
.
HasColumnType
(
"text"
);
b
.
Property
<
int
>(
"PhoneId"
)
.
HasColumnType
(
"integer"
);
b
.
Property
<
string
>(
"UserName"
)
.
HasColumnType
(
"text"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"PhoneId"
);
b
.
ToTable
(
"Orders"
);
});
modelBuilder
.
Entity
(
"PhoneStore.Models.Phone"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"integer"
)
.
HasAnnotation
(
"Npgsql:ValueGenerationStrategy"
,
NpgsqlValueGenerationStrategy
.
IdentityByDefaultColumn
);
b
.
Property
<
int
?>(
"BrandId"
)
.
HasColumnType
(
"integer"
);
b
.
Property
<
string
>(
"Image"
)
.
HasColumnType
(
"text"
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"text"
);
b
.
Property
<
decimal
>(
"Price"
)
.
HasColumnType
(
"numeric"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"BrandId"
);
b
.
ToTable
(
"Phones"
);
});
modelBuilder
.
Entity
(
"PhoneStore.Models.Role"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"integer"
)
.
HasAnnotation
(
"Npgsql:ValueGenerationStrategy"
,
NpgsqlValueGenerationStrategy
.
IdentityByDefaultColumn
);
b
.
Property
<
string
>(
"ConcurrencyStamp"
)
.
IsConcurrencyToken
()
.
HasColumnType
(
"text"
);
b
.
Property
<
string
>(
"Name"
)
.
HasMaxLength
(
256
)
.
HasColumnType
(
"character varying(256)"
);
b
.
Property
<
string
>(
"NormalizedName"
)
.
HasMaxLength
(
256
)
.
HasColumnType
(
"character varying(256)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"NormalizedName"
)
.
IsUnique
()
.
HasDatabaseName
(
"RoleNameIndex"
);
b
.
ToTable
(
"AspNetRoles"
);
});
modelBuilder
.
Entity
(
"PhoneStore.Models.User"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"integer"
)
.
HasAnnotation
(
"Npgsql:ValueGenerationStrategy"
,
NpgsqlValueGenerationStrategy
.
IdentityByDefaultColumn
);
b
.
Property
<
int
>(
"AccessFailedCount"
)
.
HasColumnType
(
"integer"
);
b
.
Property
<
int
>(
"Age"
)
.
HasColumnType
(
"integer"
);
b
.
Property
<
string
>(
"ConcurrencyStamp"
)
.
IsConcurrencyToken
()
.
HasColumnType
(
"text"
);
b
.
Property
<
string
>(
"Email"
)
.
HasMaxLength
(
256
)
.
HasColumnType
(
"character varying(256)"
);
b
.
Property
<
bool
>(
"EmailConfirmed"
)
.
HasColumnType
(
"boolean"
);
b
.
Property
<
bool
>(
"LockoutEnabled"
)
.
HasColumnType
(
"boolean"
);
b
.
Property
<
DateTimeOffset
?>(
"LockoutEnd"
)
.
HasColumnType
(
"timestamp with time zone"
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"text"
);
b
.
Property
<
string
>(
"NormalizedEmail"
)
.
HasMaxLength
(
256
)
.
HasColumnType
(
"character varying(256)"
);
b
.
Property
<
string
>(
"NormalizedUserName"
)
.
HasMaxLength
(
256
)
.
HasColumnType
(
"character varying(256)"
);
b
.
Property
<
string
>(
"PasswordHash"
)
.
HasColumnType
(
"text"
);
b
.
Property
<
string
>(
"PhoneNumber"
)
.
HasColumnType
(
"text"
);
b
.
Property
<
bool
>(
"PhoneNumberConfirmed"
)
.
HasColumnType
(
"boolean"
);
b
.
Property
<
string
>(
"SecurityStamp"
)
.
HasColumnType
(
"text"
);
b
.
Property
<
bool
>(
"TwoFactorEnabled"
)
.
HasColumnType
(
"boolean"
);
b
.
Property
<
string
>(
"UserName"
)
.
HasMaxLength
(
256
)
.
HasColumnType
(
"character varying(256)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"NormalizedEmail"
)
.
HasDatabaseName
(
"EmailIndex"
);
b
.
HasIndex
(
"NormalizedUserName"
)
.
IsUnique
()
.
HasDatabaseName
(
"UserNameIndex"
);
b
.
ToTable
(
"AspNetUsers"
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>"
,
b
=>
{
b
.
HasOne
(
"PhoneStore.Models.Role"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RoleId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserClaim<int>"
,
b
=>
{
b
.
HasOne
(
"PhoneStore.Models.User"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserLogin<int>"
,
b
=>
{
b
.
HasOne
(
"PhoneStore.Models.User"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserRole<int>"
,
b
=>
{
b
.
HasOne
(
"PhoneStore.Models.Role"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RoleId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PhoneStore.Models.User"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserToken<int>"
,
b
=>
{
b
.
HasOne
(
"PhoneStore.Models.User"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"PhoneStore.Models.Basket"
,
b
=>
{
b
.
HasOne
(
"PhoneStore.Models.Phone"
,
"Phone"
)
.
WithMany
()
.
HasForeignKey
(
"PhoneId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
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"
)
.
WithMany
()
.
HasForeignKey
(
"PhoneId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Phone"
);
});
modelBuilder
.
Entity
(
"PhoneStore.Models.Phone"
,
b
=>
{
b
.
HasOne
(
"PhoneStore.Models.Brand"
,
"Brand"
)
.
WithMany
()
.
HasForeignKey
(
"BrandId"
);
b
.
Navigation
(
"Brand"
);
});
#pragma warning restore 612, 618
}
}
}
PhoneStore/Migrations/20220807165430_AddCreationDateTimeField.cs
0 → 100644
View file @
ec9df425
using
System
;
using
Microsoft.EntityFrameworkCore.Migrations
;
namespace
PhoneStore.Migrations
{
public
partial
class
AddCreationDateTimeField
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
AddColumn
<
DateTime
>(
name
:
"CreationDateTime"
,
table
:
"Feedbacks"
,
type
:
"timestamp without time zone"
,
nullable
:
false
,
defaultValue
:
new
DateTime
(
1
,
1
,
1
,
0
,
0
,
0
,
0
,
DateTimeKind
.
Unspecified
));
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropColumn
(
name
:
"CreationDateTime"
,
table
:
"Feedbacks"
);
}
}
}
PhoneStore/Migrations/MobileContextModelSnapshot.cs
View file @
ec9df425
...
@@ -159,6 +159,9 @@ namespace PhoneStore.Migrations
...
@@ -159,6 +159,9 @@ namespace PhoneStore.Migrations
.
HasColumnType
(
"integer"
)
.
HasColumnType
(
"integer"
)
.
HasAnnotation
(
"Npgsql:ValueGenerationStrategy"
,
NpgsqlValueGenerationStrategy
.
IdentityByDefaultColumn
);
.
HasAnnotation
(
"Npgsql:ValueGenerationStrategy"
,
NpgsqlValueGenerationStrategy
.
IdentityByDefaultColumn
);
b
.
Property
<
DateTime
>(
"CreationDateTime"
)
.
HasColumnType
(
"timestamp without time zone"
);
b
.
Property
<
int
>(
"PhoneId"
)
b
.
Property
<
int
>(
"PhoneId"
)
.
HasColumnType
(
"integer"
);
.
HasColumnType
(
"integer"
);
...
...
PhoneStore/Models/Feedback.cs
View file @
ec9df425
using
System
;
namespace
PhoneStore.Models
namespace
PhoneStore.Models
{
{
public
class
Feedback
public
class
Feedback
...
@@ -6,6 +8,7 @@ namespace PhoneStore.Models
...
@@ -6,6 +8,7 @@ namespace PhoneStore.Models
public
int
UserId
{
get
;
set
;
}
public
int
UserId
{
get
;
set
;
}
public
int
PhoneId
{
get
;
set
;
}
public
int
PhoneId
{
get
;
set
;
}
public
string
Text
{
get
;
set
;
}
public
string
Text
{
get
;
set
;
}
public
DateTime
CreationDateTime
{
get
;
set
;
}
public
User
User
{
get
;
set
;
}
public
User
User
{
get
;
set
;
}
public
Phone
Phone
{
get
;
set
;
}
public
Phone
Phone
{
get
;
set
;
}
}
}
...
...
PhoneStore/Models/Phone.cs
View file @
ec9df425
using
System.Collections.Generic
;
namespace
PhoneStore.Models
namespace
PhoneStore.Models
{
{
public
class
Phone
public
class
Phone
...
@@ -8,5 +10,6 @@ namespace PhoneStore.Models
...
@@ -8,5 +10,6 @@ namespace PhoneStore.Models
public
int
?
BrandId
{
get
;
set
;
}
public
int
?
BrandId
{
get
;
set
;
}
public
Brand
Brand
{
get
;
set
;
}
public
Brand
Brand
{
get
;
set
;
}
public
string
Image
{
get
;
set
;
}
public
string
Image
{
get
;
set
;
}
public
List
<
Feedback
>
Feedbacks
{
get
;
set
;
}
}
}
}
}
\ No newline at end of file
PhoneStore/Services/PhoneService.cs
View file @
ec9df425
...
@@ -50,6 +50,5 @@ namespace PhoneStore.Services
...
@@ -50,6 +50,5 @@ namespace PhoneStore.Services
_db
.
Phones
.
Add
(
entity
.
MapToPhone
(
imagePath
));
_db
.
Phones
.
Add
(
entity
.
MapToPhone
(
imagePath
));
await
_db
.
SaveChangesAsync
();
await
_db
.
SaveChangesAsync
();
}
}
}
}
}
}
\ No newline at end of file
PhoneStore/ViewModels/FeedbackCreateViewModel.cs
0 → 100644
View file @
ec9df425
namespace
PhoneStore.ViewModels
{
public
class
FeedbackCreateViewModel
{
public
int
UserId
{
get
;
set
;
}
public
int
PhoneId
{
get
;
set
;
}
public
string
Text
{
get
;
set
;
}
}
}
\ No newline at end of file
PhoneStore/ViewModels/FeedbackViewModel.cs
0 → 100644
View file @
ec9df425
using
System
;
using
PhoneStore.Models
;
namespace
PhoneStore.ViewModels
{
public
class
FeedbackViewModel
{
public
int
Id
{
get
;
set
;
}
public
int
UserId
{
get
;
set
;
}
public
int
PhoneId
{
get
;
set
;
}
public
string
Text
{
get
;
set
;
}
public
DateTime
CreationDateTime
{
get
;
set
;
}
public
User
User
{
get
;
set
;
}
public
Phone
Phone
{
get
;
set
;
}
}
}
\ No newline at end of file
PhoneStore/ViewModels/PhoneViewModel.cs
0 → 100644
View file @
ec9df425
using
System.Collections.Generic
;
using
PhoneStore.Models
;
namespace
PhoneStore.ViewModels
{
public
class
PhoneViewModel
{
public
int
Id
{
get
;
set
;
}
public
string
Name
{
get
;
set
;
}
public
decimal
Price
{
get
;
set
;
}
public
Brand
Brand
{
get
;
set
;
}
public
string
Image
{
get
;
set
;
}
public
List
<
FeedbackViewModel
>
Feedbacks
{
get
;
set
;
}
}
}
\ 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