diff --git a/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/AnimalController.cs b/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/AnimalController.cs index fd6c2db..e9f115f 100644 --- a/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/AnimalController.cs +++ b/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/AnimalController.cs @@ -135,8 +135,23 @@ namespace VeterinaryClinicWebApp.Controllers Response.Redirect("/Animal/Animals"); } - /// - /// Удалить животного - /// - } + /// + /// Удалить животного + /// + [HttpPost] + public void DeleteAnimal(int id) + { + if (APIClient.User == null) + { + throw new Exception("Необходимо авторизоваться!"); + } + + _animalLogic.Delete(new AnimalBindingModel + { + Id = id + }); + + Response.Redirect("/Animal/Animals"); + } + } } diff --git a/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/HomeController.cs b/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/HomeController.cs index 8c5db71..a62b34e 100644 --- a/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/HomeController.cs +++ b/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/HomeController.cs @@ -148,34 +148,45 @@ public class HomeController : Controller Response.Redirect("Enter"); } - /// - /// - /// + /// + /// + /// + [HttpGet] + public void Logout() + { + if (APIClient.User == null) + { + throw new Exception(" !"); + } - /// - /// - /// + APIClient.User = null; + Response.Redirect("Enter"); + } - /// - /// Word - /// + /// + /// + /// - /// - /// Excel - /// + /// + /// Word + /// - /// - /// Pdf - /// + /// + /// Excel + /// - /// - /// - /// + /// + /// Pdf + /// - /// - /// - /// - [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + /// + /// + /// + + /// + /// + /// + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public IActionResult Error() { return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); diff --git a/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/MedicationController.cs b/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/MedicationController.cs index dc15948..81e3f18 100644 --- a/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/MedicationController.cs +++ b/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/MedicationController.cs @@ -109,9 +109,23 @@ namespace VeterinaryClinicWebApp.Controllers Response.Redirect("/Medication/Medications"); } - /// - /// Удалить лекарство - /// + /// + /// Удалить лекарство + /// + [HttpPost] + public void DeleteMedication(int id) + { + if (APIClient.User == null) + { + throw new Exception("Необходимо авторизоваться!"); + } - } + _medicationLogic.Delete(new MedicationBindingModel + { + Id = id + }); + + Response.Redirect("/Medication/Medications"); + } + } } diff --git a/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/ServiceController.cs b/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/ServiceController.cs index 849f1ab..245f1cd 100644 --- a/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/ServiceController.cs +++ b/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/ServiceController.cs @@ -25,7 +25,7 @@ namespace VeterinaryClinicWebApp.Controllers } /// - /// Вывести список животных + /// Вывести список услуг /// [HttpGet] public IActionResult Services() @@ -39,7 +39,7 @@ namespace VeterinaryClinicWebApp.Controllers } /// - /// Создать животного + /// Создать услугу /// [HttpGet] public IActionResult CreateService() @@ -78,7 +78,7 @@ namespace VeterinaryClinicWebApp.Controllers } /// - /// Редактировать животного + /// Редактировать услугу /// [HttpGet] public IActionResult UpdateService(int id) @@ -120,8 +120,23 @@ namespace VeterinaryClinicWebApp.Controllers Response.Redirect("/Service/Services"); } - /// - /// Удалить животного - /// - } + /// + /// Удалить услугу + /// + [HttpPost] + public void DeleteService(int id) + { + if (APIClient.User == null) + { + throw new Exception("Необходимо авторизоваться!"); + } + + _serviceLogic.Delete(new ServiceBindingModel + { + Id = id + }); + + Response.Redirect("/Service/Services"); + } + } } diff --git a/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/VaccinationController.cs b/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/VaccinationController.cs index ce904e7..d49277e 100644 --- a/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/VaccinationController.cs +++ b/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/VaccinationController.cs @@ -43,7 +43,7 @@ namespace VeterinaryClinicWebApp.Controllers } /// - /// Создать животного + /// Создать вакцинаю /// [HttpGet] public IActionResult CreateVaccination() @@ -87,7 +87,7 @@ namespace VeterinaryClinicWebApp.Controllers } /// - /// Редактировать животного + /// Редактировать вакцинацию /// [HttpGet] public IActionResult UpdateVaccination(int id) @@ -134,8 +134,23 @@ namespace VeterinaryClinicWebApp.Controllers Response.Redirect("/Vaccination/Vaccinations"); } - /// - /// Удалить животного - /// - } + /// + /// Удалить вакцинацию + /// + [HttpPost] + public void DeleteVaccination(int id) + { + if (APIClient.User == null) + { + throw new Exception("Необходимо авторизоваться!"); + } + + _vaccinationLogic.Delete(new VaccinationBindingModel + { + Id = id + }); + + Response.Redirect("/Vaccination/Vaccinations"); + } + } } diff --git a/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/VisitController.cs b/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/VisitController.cs index f1e4386..52ee9e7 100644 --- a/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/VisitController.cs +++ b/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/VisitController.cs @@ -28,7 +28,7 @@ namespace VeterinaryClinicWebApp.Controllers } /// - /// Вывести список животных + /// Вывести список визитов /// public IActionResult Visits() { @@ -44,7 +44,7 @@ namespace VeterinaryClinicWebApp.Controllers } /// - /// Создать животного + /// Создать визит /// [HttpGet] public IActionResult CreateVisit() @@ -101,7 +101,7 @@ namespace VeterinaryClinicWebApp.Controllers } /// - /// Редактировать животного + /// Редактировать визит /// [HttpGet] public IActionResult UpdateVisit(int id) @@ -162,7 +162,22 @@ namespace VeterinaryClinicWebApp.Controllers } /// - /// Удалить животного + /// Удалить визит /// + [HttpPost] + public void DeleteVisit(int id) + { + if (APIClient.User == null) + { + throw new Exception("Необходимо авторизоваться!"); + } + + _visitLogic.Delete(new VisitBindingModel + { + Id = id + }); + + Response.Redirect("/Visit/Visits"); + } } } diff --git a/VeterinaryClinic/VeterinaryClinicWebApp/Views/Shared/_Layout.cshtml b/VeterinaryClinic/VeterinaryClinicWebApp/Views/Shared/_Layout.cshtml index f8d2f87..8090cb2 100644 --- a/VeterinaryClinic/VeterinaryClinicWebApp/Views/Shared/_Layout.cshtml +++ b/VeterinaryClinic/VeterinaryClinicWebApp/Views/Shared/_Layout.cshtml @@ -17,19 +17,7 @@