поправила курсы на их удаление, пытаюсь найти ошибку (при создании рецепта добавляется пустой курс + в созданном рецепте номер курса не равен выбранному, а просто нумеруется по порядку)

This commit is contained in:
Елена Бакальская 2024-05-29 02:26:50 +04:00
parent 0b7869e140
commit 84a5ee78c7
7 changed files with 15 additions and 14 deletions

View File

@ -105,7 +105,7 @@ namespace PolyclinicBusinessLogic.BusinessLogics
saveToWord.CreateDoc(new WordCoursesByProceduresInfo saveToWord.CreateDoc(new WordCoursesByProceduresInfo
{ {
FileName = model.FileName, FileName = model.FileName,
Title = "Курсы по процедурам", Title = "Курсы по процедуре",
Courses = GetProcedureCourses(procedureSearchMode) Courses = GetProcedureCourses(procedureSearchMode)
}); });
} }

View File

@ -12,11 +12,11 @@ namespace PolyclinicBusinessLogic.OfficePackage
{ {
Texts = new List<(string, WordTextProperties)> Texts = new List<(string, WordTextProperties)>
{ {
(info.Title, new WordTextProperties { Bold = true, Size = "24", }) (info.Title, new WordTextProperties { Bold = true, Size = "32", })
}, },
TextProperties = new WordTextProperties TextProperties = new WordTextProperties
{ {
Size = "24", Size = "32",
JustificationType = WordJustificationType.Center JustificationType = WordJustificationType.Center
} }
}); });
@ -26,13 +26,13 @@ namespace PolyclinicBusinessLogic.OfficePackage
{ {
Texts = new List<(string, WordTextProperties)> Texts = new List<(string, WordTextProperties)>
{ {
("Количество пилюль в день: " + course.PillsPerDay.ToString() + " единиц", new WordTextProperties{ Size = "16"}), ("Количество пилюль в день: " + course.PillsPerDay.ToString() + " единиц", new WordTextProperties{ Size = "24"}),
("Количество дней приёма: " + course.DaysCount.ToString() + " дней", new WordTextProperties{ Size = "16"}), ("Количество дней приёма: " + course.DaysCount.ToString() + " дней", new WordTextProperties{ Size = "24"}),
}, },
TextProperties = new WordTextProperties TextProperties = new WordTextProperties
{ {
Size = "16", Size = "24",
JustificationType = WordJustificationType.Both JustificationType = WordJustificationType.Both
} }
}); });

View File

@ -80,12 +80,14 @@ namespace PolyclinicWebAppSuretor.Controllers
{ {
ProceduresCount = model.RecipeViewModel.ProceduresCount, ProceduresCount = model.RecipeViewModel.ProceduresCount,
Comment = model.RecipeViewModel.Comment, Comment = model.RecipeViewModel.Comment,
CourseId = model.RecipeViewModel.CourseId,
RecipeProcedures = selectedProcedures RecipeProcedures = selectedProcedures
.ToDictionary( .ToDictionary(
x => x, x => x,
x => allProcedures.Where(y => y.Id == x) as IProcedureModel x => allProcedures.First(y => y.Id == x) as IProcedureModel
) )
}; };
_recipeLogic.Create(recipe); _recipeLogic.Create(recipe);
return RedirectToAction("Recipes"); return RedirectToAction("Recipes");
} }
@ -114,10 +116,11 @@ namespace PolyclinicWebAppSuretor.Controllers
Id = id, Id = id,
ProceduresCount = model.RecipeViewModel.ProceduresCount, ProceduresCount = model.RecipeViewModel.ProceduresCount,
Comment = model.RecipeViewModel.Comment, Comment = model.RecipeViewModel.Comment,
CourseId = model.RecipeViewModel.CourseId,
RecipeProcedures = selectedProcedures RecipeProcedures = selectedProcedures
.ToDictionary( .ToDictionary(
x => x, x => x,
x => allProcedures.Where(y => y.Id == x) as IProcedureModel x => allProcedures.First(y => y.Id == x) as IProcedureModel
) )
}; };
_recipeLogic.Update(recipe); _recipeLogic.Update(recipe);

View File

@ -29,11 +29,11 @@
<h3 class="col-3"> <h3 class="col-3">
Курс (номер): Курс (номер):
</h3> </h3>
<select id="courseId" style="width: 45vh" asp-for="RecipeViewModel.CourseId"> <select style="width: 45vh" id="courseId" name="courseId" asp-for="RecipeViewModel.CourseId">
<option value="">Выберите номер курса</option> <option>Выберите номер курса</option>
@foreach (var course in ViewBag.Courses) @foreach (var course in ViewBag.Courses)
{ {
<option value="@course.Id">@course.PillsPerDay</option> <option value="@course.Id">@course.Id</option>
} }
</select> </select>
</div> </div>
@ -65,7 +65,6 @@
</div> </div>
</div> </div>
<div class="d-flex flex-column mb-5 mt-5"> <div class="d-flex flex-column mb-5 mt-5">
<div class="col-8"></div> <div class="col-8"></div>
<div class="col-4"> <div class="col-4">

View File

@ -47,7 +47,7 @@
<tr> <tr>
<td>@item.Id</td> <td>@item.Id</td>
<td>@item.Comment</td> <td>@item.Comment</td>
<td>@item.ProceduresCount</td <td>@item.ProceduresCount</td>
<td>@item.CourseId</td> <td>@item.CourseId</td>
<td> <td>
<a asp-action="EditRecipe" asp-route-id="@item.Id"> <a asp-action="EditRecipe" asp-route-id="@item.Id">
@ -69,7 +69,6 @@
</td> </td>
</tr> </tr>
} }
</tbody> </tbody>