diff --git a/VeterinaryView/VeterinaryContracts/ViewModels/PurchaseViewModel.cs b/VeterinaryView/VeterinaryContracts/ViewModels/PurchaseViewModel.cs index 7b0b8ff..9723f15 100644 --- a/VeterinaryView/VeterinaryContracts/ViewModels/PurchaseViewModel.cs +++ b/VeterinaryView/VeterinaryContracts/ViewModels/PurchaseViewModel.cs @@ -8,8 +8,9 @@ namespace VeterinaryContracts.ViewModels public int Id { get; set; } [DisplayName("Хозяин")] public int OwnerId { get; set; } - [DisplayName("Лекарство")] public int DrugId { get; set; } + [DisplayName("Лекарство")] + public string DrugName { get; set; } = string.Empty; [DisplayName("Количество")] public int Count { get; set; } [DisplayName("Сумма")] diff --git a/VeterinaryView/VeterinaryDatabaseImplement/Models/Purchase.cs b/VeterinaryView/VeterinaryDatabaseImplement/Models/Purchase.cs index d57b977..d5363ec 100644 --- a/VeterinaryView/VeterinaryDatabaseImplement/Models/Purchase.cs +++ b/VeterinaryView/VeterinaryDatabaseImplement/Models/Purchase.cs @@ -62,6 +62,7 @@ namespace VeterinaryDatabaseImplement.Models Sum = Sum, OwnerId = OwnerId, DrugId = DrugId, + DrugName = Drug?.DrugName ?? string.Empty, DateCreate = DateCreate }; } diff --git a/VeterinaryView/VeterinaryShowOwnerApp/Controllers/HomeController.cs b/VeterinaryView/VeterinaryShowOwnerApp/Controllers/HomeController.cs index 8c645c7..10e6333 100644 --- a/VeterinaryView/VeterinaryShowOwnerApp/Controllers/HomeController.cs +++ b/VeterinaryView/VeterinaryShowOwnerApp/Controllers/HomeController.cs @@ -370,7 +370,7 @@ namespace VeterinaryShowOwnerApp.Controllers DateCreate = DateTime.Now, Count = count }); - Response.Redirect("Index"); + Response.Redirect("Purchases"); } // с какого хера ты не работаешь [HttpPost] diff --git a/VeterinaryView/VeterinaryShowOwnerApp/Views/Home/Purchases.cshtml b/VeterinaryView/VeterinaryShowOwnerApp/Views/Home/Purchases.cshtml index ddf37b9..640ba0a 100644 --- a/VeterinaryView/VeterinaryShowOwnerApp/Views/Home/Purchases.cshtml +++ b/VeterinaryView/VeterinaryShowOwnerApp/Views/Home/Purchases.cshtml @@ -46,7 +46,7 @@ @Html.DisplayFor(modelItem => - item.DrugId) + item.DrugName) @Html.DisplayFor(modelItem =>