From 524ef743f3e0b45df955151beba5c7ae7a404a91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BE=D0=BB=D0=BE=D0=B4=D1=8F?= Date: Wed, 17 May 2023 21:15:18 +0300 Subject: [PATCH] =?UTF-8?q?CRUD=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D0=BE=D0=B4?= =?UTF-8?q?=D0=B5=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/HomeController.cs | 7 ++-- .../Views/Home/DiySetting.cshtml | 41 +++++++++++++++++++ 2 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 SchoolAgainStudy/StudentWebClient/Views/Home/DiySetting.cshtml diff --git a/SchoolAgainStudy/StudentWebClient/Controllers/HomeController.cs b/SchoolAgainStudy/StudentWebClient/Controllers/HomeController.cs index 554e8d1..ebac057 100644 --- a/SchoolAgainStudy/StudentWebClient/Controllers/HomeController.cs +++ b/SchoolAgainStudy/StudentWebClient/Controllers/HomeController.cs @@ -205,7 +205,7 @@ namespace StudentWebClient.Controllers { return Redirect("~/Home/Enter"); } - return View(_diy.ReadList(new DiySearchModel { Id = APIClient.Student.Id})); + return View(_diy.ReadList(new DiySearchModel { StudentId = APIClient.Student.Id})); } [HttpGet] public IActionResult CreateDiy() @@ -250,7 +250,7 @@ namespace StudentWebClient.Controllers public IActionResult DiySetting(int id) { var diy = _diy.ReadElement(new DiySearchModel { Id = id }); - var interests = _interest.ReadList(null).Select(x => new {InterestId = x.Id, InterestName = x.Title}).ToList(); + var interests = _interest.ReadList(new InterestSearchModel { StudentId = APIClient.Student.Id}).Select(x => new {InterestId = x.Id, InterestName = x.Title}).ToList(); var selectedInterests = diy.DiyInterests.Select(x => x.Key).ToArray(); ViewBag.Interests = new MultiSelectList(interests, "InterestId", "InterestName", selectedInterests); ViewBag.Tasks = _task.ReadList(null); @@ -287,8 +287,9 @@ namespace StudentWebClient.Controllers { diyInterests.Add(id, _interest.ReadElement(new InterestSearchModel { Id = id })); } - _diy.Create(new DiyBindingModel + _diy.Update(new DiyBindingModel { + Id = idDiy, StudentId = APIClient.Student.Id, StudentName = APIClient.Student.Name, Title = title, diff --git a/SchoolAgainStudy/StudentWebClient/Views/Home/DiySetting.cshtml b/SchoolAgainStudy/StudentWebClient/Views/Home/DiySetting.cshtml new file mode 100644 index 0000000..c6ef3eb --- /dev/null +++ b/SchoolAgainStudy/StudentWebClient/Views/Home/DiySetting.cshtml @@ -0,0 +1,41 @@ +@using SchoolAgainStudyContracts.ViewModel; +@model DiyViewModel +@{ + ViewData["Title"] = "Setting"; +} +
+

@Model.Title

+
+
+
+
+ + +
+
+
+
Название:
+
+
+
+
Описание:
+
:
+
+
+
Дата создания:
+
@Html.TextBox("dateCreate" ,"" ,new {type="Date"})
+
+
+
Задание:
+
+ +
+
+
+
Интересы:
+
+ @Html.ListBox("interests", (MultiSelectList)ViewBag.Interests) +
+
+ +