Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
lesson60
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
Нурбек Созоев
lesson60
Commits
c566e00b
Commit
c566e00b
authored
May 29, 2019
by
Нурбек Созоев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил action Create в контроллер Products
parent
2f4e2186
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
14 deletions
+44
-14
ProductController.cs
Store/Controllers/ProductController.cs
+14
-0
Create.cshtml
Store/Views/Product/Create.cshtml
+27
-14
_MainLayout.cshtml
Store/Views/Shared/_MainLayout.cshtml
+3
-0
No files found.
Store/Controllers/ProductController.cs
View file @
c566e00b
...
@@ -45,5 +45,19 @@ namespace Store.Controllers
...
@@ -45,5 +45,19 @@ namespace Store.Controllers
Category
=
"TV"
Category
=
"TV"
});
});
}
}
[
HttpGet
]
public
IActionResult
Create
()
{
return
View
();
}
[
HttpPost
]
public
IActionResult
Create
(
Product
product
)
{
return
View
(
"Details"
,
product
);
}
}
}
}
}
Store/Views/Product/Create.cshtml
View file @
c566e00b
@model object
@{
@{
Layout =
null
;
Layout =
"_MainLayout"
;
}
}
<!DOCTYPE html>
<h2>Create product:</h2>
<hr/>
<form action="/Product/Create" method="post" >
<div class="form-group">
<label for="">Name</label>
<input type="text" class="form-control" id="Name" name="Name" placeholder="Enter name">
</div>
<div class="form-group">
<label for="">Category</label>
<input type="text" class="form-control" id="Category" name="Category" placeholder="Enter category">
</div>
<div class="form-group">
<label for="">Brand</label>
<input type="text" class="form-control" id="Brand" name="Brand" placeholder="Enter brand">
</div>
<div class="form-group">
<label for="">Amount</label>
<input type="text" class="form-control" id="Amount" name="Amount" placeholder="Enter amount">
</div>
<button type="submit" class="btn btn-primary">Create</button>
</form>
<html>
<head>
<title>
title
</title>
</head>
<body>
<div>
</div>
</body>
</html>
\ No newline at end of file
Store/Views/Shared/_MainLayout.cshtml
View file @
c566e00b
...
@@ -24,6 +24,9 @@
...
@@ -24,6 +24,9 @@
<li>
<li>
<a
href=
"/Product/Index"
>
Main
</a>
<a
href=
"/Product/Index"
>
Main
</a>
</li>
</li>
<li>
<a
href=
"/Product/Create"
>
Create
</a>
</li>
</ul>
</ul>
</div>
</div>
</div>
</div>
...
...
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