1 | @using Microsoft.AspNetCore.Identity
|
---|
2 | @inject SignInManager<IdentityUser> SignInManager
|
---|
3 | @model IEnumerable<PostgreSqlDotnetCore.Models.ProductsClass>
|
---|
4 |
|
---|
5 | @{
|
---|
6 | ViewBag.Title = "Products";
|
---|
7 | }
|
---|
8 | <style>
|
---|
9 | .edit-crud-products > a {
|
---|
10 | background-color: black;
|
---|
11 | padding: 3px;
|
---|
12 | border-radius: 5px;
|
---|
13 | color: white;
|
---|
14 | }
|
---|
15 |
|
---|
16 | .item-product {
|
---|
17 | color: #fff;
|
---|
18 | margin-bottom: 16px;
|
---|
19 | }
|
---|
20 |
|
---|
21 | .item-product > .thumbnail {
|
---|
22 | background-color: #11698E;
|
---|
23 | border-radius: 40px;
|
---|
24 | color: #fff;
|
---|
25 | padding: 16px;
|
---|
26 | }
|
---|
27 |
|
---|
28 | .btn-product {
|
---|
29 | width: 100%;
|
---|
30 | }
|
---|
31 |
|
---|
32 | .productbox {
|
---|
33 | background-color: #ffffff;
|
---|
34 | padding: 10px;
|
---|
35 | margin-bottom: 10px;
|
---|
36 | -webkit-box-shadow: 0 8px 6px -6px #999;
|
---|
37 | -moz-box-shadow: 0 8px 6px -6px #999;
|
---|
38 | box-shadow: 0 8px 6px -6px #999;
|
---|
39 | }
|
---|
40 |
|
---|
41 | .producttitle {
|
---|
42 | font-weight: bold;
|
---|
43 | padding: 5px 0 5px 0;
|
---|
44 | }
|
---|
45 |
|
---|
46 | .productprice {
|
---|
47 | border-top: 1px solid #dadada;
|
---|
48 | padding-top: 5px;
|
---|
49 | }
|
---|
50 |
|
---|
51 | .pricetext {
|
---|
52 | font-weight: bold;
|
---|
53 | font-size: 1.4em;
|
---|
54 | }
|
---|
55 |
|
---|
56 | #SearchString {
|
---|
57 | width: 200px;
|
---|
58 | margin: 3px;
|
---|
59 | }
|
---|
60 | </style>
|
---|
61 | <h2>All type of products</h2>
|
---|
62 | @if (SignInManager.IsSignedIn(User) && ViewBag.hasAccess != null)
|
---|
63 | {
|
---|
64 | <p>
|
---|
65 | @Html.ActionLink("Create New", "Create")
|
---|
66 | </p>
|
---|
67 | }
|
---|
68 |
|
---|
69 |
|
---|
70 | @using (Html.BeginForm("Index", "Products", FormMethod.Get))
|
---|
71 |
|
---|
72 | {
|
---|
73 |
|
---|
74 | <p style="display:flex">
|
---|
75 |
|
---|
76 | Find by name: @Html.TextBox("SearchString", ViewBag.CurrentFilter as string, new { @class = "form-control", @placeholder = "Seach by name"})
|
---|
77 |
|
---|
78 | <input type="submit" class="btn btn-secondary" style="margin:3px" value="Search" />
|
---|
79 |
|
---|
80 | </p>
|
---|
81 |
|
---|
82 | }
|
---|
83 |
|
---|
84 | <div class="row">
|
---|
85 | @foreach (var item in Model)
|
---|
86 | {
|
---|
87 |
|
---|
88 | <div class="col-sm-6 col-md-4 column item-product">
|
---|
89 | <div class="thumbnail">
|
---|
90 | <h4 class="text-center">
|
---|
91 | <span class="label label-info">
|
---|
92 | @item.category
|
---|
93 | </span>
|
---|
94 | </h4>
|
---|
95 | <img style="width: -webkit-fill-available;" src="http://placehold.it/460x250/e67e22/ffffff&text=HTML5" class="img-responsive">
|
---|
96 | <div class="caption">
|
---|
97 | <div class="row">
|
---|
98 | <div class="col-md-6 col-xs-6">
|
---|
99 | <h3>@item.name</h3>
|
---|
100 | @if (SignInManager.IsSignedIn(User) && ViewBag.hasAccess != null)
|
---|
101 | // SignInManager.IsSignedIn(User) && ViewBag.hasAccess != null
|
---|
102 | //SignInManager.IsSignedIn(User) && ViewBag.hasAccess != null && ViewBag.hasAccess == true
|
---|
103 |
|
---|
104 |
|
---|
105 | {
|
---|
106 | <div class="edit-crud-products">
|
---|
107 | @Html.ActionLink("Edit", "Edit", new { id = item.id }) |
|
---|
108 | @Html.ActionLink("Details", "Details", new { id = item.id }) |
|
---|
109 | @Html.ActionLink("Delete", "Delete", new { id = item.id })
|
---|
110 | @Html.ActionLink("Procedure", "Procedure", new { id = item.id })
|
---|
111 | </div>
|
---|
112 | }
|
---|
113 | </div>
|
---|
114 |
|
---|
115 |
|
---|
116 | <div class="col-md-6 col-xs-6 price">
|
---|
117 | <h3>
|
---|
118 | <label>$ @item.price</label>
|
---|
119 | </h3>
|
---|
120 | </div>
|
---|
121 | </div>
|
---|
122 | <p>
|
---|
123 | @item.description
|
---|
124 | </p>
|
---|
125 | <div class="row">
|
---|
126 | <div class="col-md-6">
|
---|
127 | <a class="btn btn-primary btn-product">
|
---|
128 | <span class="glyphicon glyphicon-thumbs-up"></span>
|
---|
129 | @item.dateadded
|
---|
130 | </a>
|
---|
131 | </div>
|
---|
132 | <div class="col-md-6">
|
---|
133 | <a href="#" class="btn @(item.isactive ? "btn-success" : "btn-danger") btn-product">
|
---|
134 | <span class="glyphicon glyphicon-shopping-cart"></span>
|
---|
135 | IsActive: @item.isactive
|
---|
136 | </a>
|
---|
137 | </div>
|
---|
138 | </div>
|
---|
139 |
|
---|
140 | <p> </p>
|
---|
141 | </div>
|
---|
142 | </div>
|
---|
143 | </div>
|
---|
144 | }
|
---|
145 | </div>
|
---|
146 |
|
---|
147 | <br />
|
---|
148 | @* <table class="table">
|
---|
149 | <tr>
|
---|
150 |
|
---|
151 | <th>
|
---|
152 | @Html.DisplayNameFor(model => model.name)
|
---|
153 | </th>
|
---|
154 | <th>
|
---|
155 | @Html.DisplayNameFor(model => model.description)
|
---|
156 | </th>
|
---|
157 | <th>
|
---|
158 | @Html.DisplayNameFor(model => model.price)
|
---|
159 | </th>
|
---|
160 | <th>
|
---|
161 | @Html.DisplayNameFor(model => model.isactive)
|
---|
162 | </th>
|
---|
163 | <th>
|
---|
164 | @Html.DisplayNameFor(model => model.dateadded)
|
---|
165 | </th>
|
---|
166 | <th>
|
---|
167 | @Html.DisplayNameFor(model => model.category)
|
---|
168 | </th>
|
---|
169 | <th></th>
|
---|
170 |
|
---|
171 | </tr>
|
---|
172 |
|
---|
173 | @foreach (var item in Model)
|
---|
174 | {
|
---|
175 | <tr>
|
---|
176 | <td>
|
---|
177 | @Html.DisplayFor(modelItem => item.name)
|
---|
178 | </td>
|
---|
179 | <td>
|
---|
180 | @Html.DisplayFor(modelItem => item.description)
|
---|
181 | </td>
|
---|
182 |
|
---|
183 | <td>
|
---|
184 | @Html.DisplayFor(modelItem => item.price)
|
---|
185 | </td>
|
---|
186 | <th>
|
---|
187 | @Html.DisplayFor(model => item.isactive)
|
---|
188 | </th>
|
---|
189 | <td>
|
---|
190 | @Html.DisplayFor(modelItem => item.dateadded)
|
---|
191 | </td>
|
---|
192 | <th>
|
---|
193 | @Html.DisplayFor(model => item.category)
|
---|
194 | </th>
|
---|
195 | @if (SignInManager.IsSignedIn(User))
|
---|
196 | {
|
---|
197 | <td>
|
---|
198 | @Html.ActionLink("Edit", "Edit", new { id = item.id }) |
|
---|
199 | @Html.ActionLink("Details", "Details", new { id = item.id }) |
|
---|
200 | @Html.ActionLink("Delete", "Delete", new { id = item.id })
|
---|
201 | </td>
|
---|
202 | }
|
---|
203 | </tr>
|
---|
204 | }
|
---|
205 |
|
---|
206 | </table>
|
---|
207 | *@ |
---|