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
2904c5b6
Commit
2904c5b6
authored
Jun 06, 2019
by
Нурбек Созоев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил контроллер Supplier
parent
0b0a0b8b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
4 deletions
+51
-4
SupplierController.cs
Store/Controllers/SupplierController.cs
+30
-0
Startup.cs
Store/Startup.cs
+1
-1
Index.cshtml
Store/Views/Product/Index.cshtml
+1
-3
_MainLayout.cshtml
Store/Views/Shared/_MainLayout.cshtml
+3
-0
Create.cshtml
Store/Views/Supplier/Create.cshtml
+15
-0
_ViewImports.cshtml
Store/Views/_ViewImports.cshtml
+1
-0
No files found.
Store/Controllers/SupplierController.cs
0 → 100644
View file @
2904c5b6
using
Microsoft.AspNetCore.Mvc
;
using
Store.Models
;
namespace
Store.Controllers
{
public
class
SupplierController
:
Controller
{
private
ProductContext
_context
;
public
SupplierController
(
ProductContext
context
)
{
_context
=
context
;
}
[
HttpGet
]
public
IActionResult
Create
()
{
return
View
(
new
Supplier
());
}
[
HttpPost
]
public
IActionResult
Create
(
Supplier
supplier
)
{
_context
.
Suppliers
.
Add
(
supplier
);
_context
.
SaveChanges
();
return
View
(
supplier
);
}
}
}
Store/Startup.cs
View file @
2904c5b6
...
...
@@ -59,7 +59,7 @@ namespace Store
name
:
"default"
,
template
:
"{controller=Product}/{action=Index}"
);
routes
.
MapRoute
(
name
:
"details"
,
template
:
"{controller=Product}/{action=Details}
/{id}
"
);
name
:
"details"
,
template
:
"{controller=Product}/{action=Details}"
);
});
}
}
...
...
Store/Views/Product/Index.cshtml
View file @
2904c5b6
...
...
@@ -27,10 +27,8 @@
<td>@product.Category</td>
<td>@product.Amount</td>
<td>@product.Brand</td>
<td><a href="/Product/Details
/
@product.Id" class="btn btn-sm btn-link">Show</a></td>
<td><a href="/Product/Details
?id=
@product.Id" class="btn btn-sm btn-link">Show</a></td>
</tr>
}
</tbody>
</table>
Store/Views/Shared/_MainLayout.cshtml
View file @
2904c5b6
...
...
@@ -27,6 +27,9 @@
<li>
<a
href=
"/Product/Create"
>
Create
</a>
</li>
<li>
<a
asp-controller=
"Supplier"
asp-action=
"Create"
>
Create supplier
</a>
</li>
</ul>
</div>
</div>
...
...
Store/Views/Supplier/Create.cshtml
0 → 100644
View file @
2904c5b6
@model Store.Models.Supplier
@{
Layout = "_MainLayout";
}
<h2>Create supplier:</h2>
<hr/>
<form asp-controller="Supplier" asp-action="Create" method="post">
<input asp-for="Name"/>
<input type="submit" value="Save"/>
</form>
Store/Views/_ViewImports.cshtml
0 → 100644
View file @
2904c5b6
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
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