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
3351f367
Commit
3351f367
authored
Aug 07, 2022
by
Пасько Виталий
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил страницу с подробным описанием телефона.
#1
parent
ab51e8bc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
4 deletions
+17
-4
PhonesController.cs
PhoneStore/Controllers/PhonesController.cs
+3
-3
About.cshtml
PhoneStore/Views/Phones/About.cshtml
+7
-0
Index.cshtml
PhoneStore/Views/Phones/Index.cshtml
+6
-0
_Layout.cshtml
PhoneStore/Views/Shared/_Layout.cshtml
+1
-1
No files found.
PhoneStore/Controllers/PhonesController.cs
View file @
3351f367
...
...
@@ -137,12 +137,12 @@ namespace PhoneStore.Controllers
}
[
HttpGet
]
public
IActionResult
About
(
int
?
i
d
)
public
IActionResult
About
(
int
?
phoneI
d
)
{
if
(!
i
d
.
HasValue
)
return
RedirectToAction
(
"Error"
,
"Errors"
,
new
{
statusCode
=
777
});
if
(!
phoneI
d
.
HasValue
)
return
RedirectToAction
(
"Error"
,
"Errors"
,
new
{
statusCode
=
777
});
var
phone
=
_db
.
Phones
.
Include
(
p
=>
p
.
Brand
)
.
FirstOrDefault
(
p
=>
p
.
Id
==
i
d
);
.
FirstOrDefault
(
p
=>
p
.
Id
==
phoneI
d
);
if
(
phone
is
null
)
return
RedirectToAction
(
"Error"
,
"Errors"
,
new
{
statusCode
=
777
});
...
...
PhoneStore/Views/Phones/About.cshtml
View file @
3351f367
...
...
@@ -6,3 +6,10 @@
}
<h2>@Model.Name</h2>
<div class="card mb-3">
<img class="card-img-top w-50" src="~/@Model.Image" alt="Card image cap">
<div class="card-body">
<h5 class="card-title">@Model.Brand.Name</h5>
<p class="card-text">@(Model.Price.ToString("C2"))</p>
</div>
</div>
\ No newline at end of file
PhoneStore/Views/Phones/Index.cshtml
View file @
3351f367
...
...
@@ -65,6 +65,12 @@ else
class="dropdown-item">
Изменить
</a>
<a asp-route-phoneId="@phone.Id"
asp-action="About"
asp-controller="Phones"
class="dropdown-item">
Подробнее
</a>
<a asp-route-phoneId="@phone.Id"
asp-action="Delete"
asp-controller="Phones"
...
...
PhoneStore/Views/Shared/_Layout.cshtml
View file @
3351f367
...
...
@@ -35,7 +35,7 @@
<p>
@User.Identity.Name
</p>
<form
method=
"post"
asp-controller=
"Account"
asp-action=
"LogOff"
>
<
input
type=
"submit"
value=
"Выход"
/
>
<
button
class=
"btn btn-outline-warning"
type=
"submit"
>
Выход
</button
>
</form>
}
else
...
...
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