Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @model PILG_POU.Models.CourseModel
- @*
- *@
- @{
- ViewData["Title"] = "Перечень оказываемых услуг";
- ViewData["format1"] = ".jpg";
- ViewData["format2"] = ".docx";
- }
- <h2 class="hh2">@ViewData["Title"]</h2>
- <h3 class="hh3">@ViewData["Message"]</h3>
- @if (!User.Identity.IsAuthenticated)
- {
- <div class="p_ab">
- <a href="http://localhost:49462/Register">Зарегистрируйтесь</a> или <a href="http://localhost:49462/Login">войдите</a><label>, чтобы добавить курс в "сумку"!</label>
- </div><br />
- }
- @if (User.IsInRole("admin"))
- {
- <div class="p_ab">
- <a href="http://localhost:49462/AddCourse">Добавить курс</a>
- </div><br />
- }
- <table class="crstable">
- <tr> <th width="16%">Название курса</th><th width="8%">Возраст</th><th width="10%">Преподаватель</th><th width="28%">Описание курса</th><th width="7%">Период</th><th width="7%">Цена курса</th></tr>
- </table>
- @foreach (var curs in ViewBag.Courses)
- {
- @if (User.Identity.IsAuthenticated)
- {
- if (User.Identity.Name == "admin")
- {
- /*скрыть курс*/
- <a asp-controller="Home" asp-action="HideCourse" asp-route-id="@curs.Id">
- @if (!curs.Hidden)
- {<span>Показать</span>}
- else
- {<span>Скрыть</span> }
- </a>
- /*удалить курс*/
- <a asp-controller="Home" asp-action="DeleteCourse" asp-route-id="@curs.Id">
- <span>Удалить</span>
- </a>
- /*редактировать курс*/
- <a asp-controller="Home" asp-action="EditCourse" asp-route-id="@curs.Id">
- <span>Правка</span><br />
- </a>
- }
- @if (ViewBag.EditCrsId == curs.Id)
- {
- <form>
- <div class="main">
- <textarea hidden asp-for="Id">@curs.Id</textarea>
- <div class="p_ab">
- <textarea class="lbl" asp-for="CourseName" required></textarea>
- <textarea class="lbl" asp-for="CourseOld" required></textarea>
- <textarea class="lbl" asp-for="CourseDescription" required></textarea>
- <textarea class="lbl" asp-for="CourseTime" required></textarea>
- <textarea class="lbl" asp-for="CourseCost" required></textarea>
- </div> <br />
- <input class="btn" type="submit" value="Отправить" asp-controller="Home" asp-action="SaveCourse">
- </div><br />
- </form>
- }
- else
- {
- @if (!curs.Hidden && !User.IsInRole("admin"))
- {
- <table class="crstable">
- <tr><td width="16%">@curs.CourseName</td><td width="8%">@curs.CourseOld</td><td width="10%"></td><td width="28%">@curs.CourseDescription<br /></td><td width="7%">@curs.CourseTime</td><td width="7%">@curs.CourseCost</td></tr>
- </table>}
- }
- }
- else if (User.IsInRole("user"))
- {
- /*добавить в корзину*/
- < a asp - controller = "Home" asp - action = "AddProduct" asp - route - id = "@curs.Id" >
- @*тут надо что-то дописать!!!*@
- < span > Положить в сумку</ span >
- </ a >
- < table class="crstable">
- <tr> <td width = "16%" > @curs.CourseName </ td >< td width="8%">@curs.CourseOld</td><td width = "10%" > @curs.CourseTeacher </ td >< td width="28%">@curs.CourseDescription<br /></td><td width = "7%" > @curs.CourseTime </ td >< td width="7%">@curs.CourseCost</td></tr>
- </table>
- }
- else if (User.IsInRole("manager"))
- {
- <table class="crstable">
- <tr> <td width = "16%" > @curs.CourseName </ td >< td width="8%">@curs.CourseOld</td><td width = "10%" > @curs.CourseTeacher </ td >< td width="28%">@curs.CourseDescription<br /></td><td width = "7%" > @curs.CourseTime </ td >< td width="7%">@curs.CourseCost</td></tr>
- </table>
- }
- }
- else {
- <table class="crstable">
- <tr> <td width="16%">@curs.CourseName</td><td width="8%">@curs.CourseOld</td><td width="10">@curs.CourseTeacher</td><td width="28%">@curs.CourseDescription<br /></td><td width="7%">@curs.CourseTime</td><td width="7%">@curs.CourseCost</td></tr>
- </table>
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement