From 723f7940c4185fad1635c2a61782dfa98c061aa1 Mon Sep 17 00:00:00 2001 From: "a.puchkina" Date: Wed, 1 May 2024 20:47:42 +0400 Subject: [PATCH] =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=87?= =?UTF-8?q?=D0=BA=D0=B8!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LawFim/LawFirmGuarantorApp/APIClient.cs | 45 ++++++++++++++ .../Controllers/ConsultationController.cs | 12 ++++ .../Controllers/HearingController.cs | 12 ++++ .../Controllers/LawyerController.cs | 12 ++++ .../LawFirmGuarantorApp.csproj | 4 ++ LawFim/LawFirmGuarantorApp/Program.cs | 7 +++ .../Views/Consultation/AddLawyer.cshtml | 31 ++++++++++ .../Consultation/ConsultationLawyers.cshtml | 61 +++++++++++++++++++ .../Consultation/CreateConsultation.cshtml | 34 +++++++++++ .../Consultation/UpdateConsultation.cshtml | 34 +++++++++++ .../Views/Hearing/AddLawyer.cshtml | 30 +++++++++ .../Views/Hearing/CreateHearing.cshtml | 28 +++++++++ .../Views/Hearing/HearingLawyers.cshtml | 60 ++++++++++++++++++ .../Views/Hearing/UpdateHearing.cshtml | 28 +++++++++ .../Views/Lawyer/CreateLawyer.cshtml | 34 +++++++++++ .../Views/Lawyer/UpdateLawyer.cshtml | 34 +++++++++++ 16 files changed, 466 insertions(+) create mode 100644 LawFim/LawFirmGuarantorApp/APIClient.cs create mode 100644 LawFim/LawFirmGuarantorApp/Controllers/ConsultationController.cs create mode 100644 LawFim/LawFirmGuarantorApp/Controllers/HearingController.cs create mode 100644 LawFim/LawFirmGuarantorApp/Controllers/LawyerController.cs create mode 100644 LawFim/LawFirmGuarantorApp/Views/Consultation/AddLawyer.cshtml create mode 100644 LawFim/LawFirmGuarantorApp/Views/Consultation/ConsultationLawyers.cshtml create mode 100644 LawFim/LawFirmGuarantorApp/Views/Consultation/CreateConsultation.cshtml create mode 100644 LawFim/LawFirmGuarantorApp/Views/Consultation/UpdateConsultation.cshtml create mode 100644 LawFim/LawFirmGuarantorApp/Views/Hearing/AddLawyer.cshtml create mode 100644 LawFim/LawFirmGuarantorApp/Views/Hearing/CreateHearing.cshtml create mode 100644 LawFim/LawFirmGuarantorApp/Views/Hearing/HearingLawyers.cshtml create mode 100644 LawFim/LawFirmGuarantorApp/Views/Hearing/UpdateHearing.cshtml create mode 100644 LawFim/LawFirmGuarantorApp/Views/Lawyer/CreateLawyer.cshtml create mode 100644 LawFim/LawFirmGuarantorApp/Views/Lawyer/UpdateLawyer.cshtml diff --git a/LawFim/LawFirmGuarantorApp/APIClient.cs b/LawFim/LawFirmGuarantorApp/APIClient.cs new file mode 100644 index 0000000..37e6daf --- /dev/null +++ b/LawFim/LawFirmGuarantorApp/APIClient.cs @@ -0,0 +1,45 @@ +using LawFirmContracts.ViewModels; +using Newtonsoft.Json; +using System.Net.Http.Headers; +using System.Text; + +namespace LawFirmGuarantorApp +{ + public class APIClient + { + private static readonly HttpClient _lawyer = new(); + public static GuarantorViewModel? Guarantor { get; set; } = null; + public static void Connect(IConfiguration configuration) + { + _lawyer.BaseAddress = new Uri(configuration["IPAddress"]); + _lawyer.DefaultRequestHeaders.Accept.Clear(); + _lawyer.DefaultRequestHeaders.Accept.Add(new + MediaTypeWithQualityHeaderValue("application/json")); + } + public static T? GetRequest(string requestUrl) + { + var response = _lawyer.GetAsync(requestUrl); + var result = response.Result.Content.ReadAsStringAsync().Result; + if (response.Result.IsSuccessStatusCode) + { + return JsonConvert.DeserializeObject(result); + } + else + { + throw new Exception(result); + } + } + public static void PostRequest(string requestUrl, T model) + { + var json = JsonConvert.SerializeObject(model); + var data = new StringContent(json, Encoding.UTF8, + "application/json"); + var response = _lawyer.PostAsync(requestUrl, data); + var result = response.Result.Content.ReadAsStringAsync().Result; + if (!response.Result.IsSuccessStatusCode) + { + throw new Exception(result); + } + } + } +} diff --git a/LawFim/LawFirmGuarantorApp/Controllers/ConsultationController.cs b/LawFim/LawFirmGuarantorApp/Controllers/ConsultationController.cs new file mode 100644 index 0000000..c0186f8 --- /dev/null +++ b/LawFim/LawFirmGuarantorApp/Controllers/ConsultationController.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc; + +namespace LawFirmGuarantorApp.Controllers +{ + public class ConsultationController : Controller + { + public IActionResult Index() + { + return View(); + } + } +} diff --git a/LawFim/LawFirmGuarantorApp/Controllers/HearingController.cs b/LawFim/LawFirmGuarantorApp/Controllers/HearingController.cs new file mode 100644 index 0000000..eb9cbcf --- /dev/null +++ b/LawFim/LawFirmGuarantorApp/Controllers/HearingController.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc; + +namespace LawFirmGuarantorApp.Controllers +{ + public class HearingController : Controller + { + public IActionResult Index() + { + return View(); + } + } +} diff --git a/LawFim/LawFirmGuarantorApp/Controllers/LawyerController.cs b/LawFim/LawFirmGuarantorApp/Controllers/LawyerController.cs new file mode 100644 index 0000000..f153aab --- /dev/null +++ b/LawFim/LawFirmGuarantorApp/Controllers/LawyerController.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc; + +namespace LawFirmGuarantorApp.Controllers +{ + public class LawyerController : Controller + { + public IActionResult Index() + { + return View(); + } + } +} diff --git a/LawFim/LawFirmGuarantorApp/LawFirmGuarantorApp.csproj b/LawFim/LawFirmGuarantorApp/LawFirmGuarantorApp.csproj index b708084..5dd4a85 100644 --- a/LawFim/LawFirmGuarantorApp/LawFirmGuarantorApp.csproj +++ b/LawFim/LawFirmGuarantorApp/LawFirmGuarantorApp.csproj @@ -6,6 +6,10 @@ enable + + + + diff --git a/LawFim/LawFirmGuarantorApp/Program.cs b/LawFim/LawFirmGuarantorApp/Program.cs index d1632a1..af8f7ee 100644 --- a/LawFim/LawFirmGuarantorApp/Program.cs +++ b/LawFim/LawFirmGuarantorApp/Program.cs @@ -1,4 +1,11 @@ +using LawFirmContracts.StoragesContracts; +using LawFirmDatabaseImplement.Implements; +using LawFirmGuarantorApp; + var builder = WebApplication.CreateBuilder(args); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); // Add services to the container. builder.Services.AddControllersWithViews(); diff --git a/LawFim/LawFirmGuarantorApp/Views/Consultation/AddLawyer.cshtml b/LawFim/LawFirmGuarantorApp/Views/Consultation/AddLawyer.cshtml new file mode 100644 index 0000000..7adcc31 --- /dev/null +++ b/LawFim/LawFirmGuarantorApp/Views/Consultation/AddLawyer.cshtml @@ -0,0 +1,31 @@ +@{ + ViewData["Title"] = "Добавить юристов"; + Layout = "~/Views/Shared/_LayoutGuarantor.cshtml"; +} + +
+

Добавить юристов

+
+
+ +
+
Юрист
+
+ +
+
+
+
Консультация
+
+ +
+
+
+
+
+ +
+
+
diff --git a/LawFim/LawFirmGuarantorApp/Views/Consultation/ConsultationLawyers.cshtml b/LawFim/LawFirmGuarantorApp/Views/Consultation/ConsultationLawyers.cshtml new file mode 100644 index 0000000..11d7499 --- /dev/null +++ b/LawFim/LawFirmGuarantorApp/Views/Consultation/ConsultationLawyers.cshtml @@ -0,0 +1,61 @@ +@using LawFirmContracts.ViewModels; + +@model List +@{ + ViewData["Title"] = "Юристы"; + Layout = "~/Views/Shared/_LayoutGuarantor.cshtml"; +} +
+

Юристы

+
+
+ @{ + if (Model == null) + { +

Авторизируйтесь

+ return; + } + + + + + + + + + + + + @foreach (var item in Model) + { + + + + + + + } + +
+ Номер юриста + + ФИО + + Телефон + + Email +
+ @Html.DisplayFor(modelItem => + item.Id) + + @Html.DisplayFor(modelItem => + item.FIO) + + @Html.DisplayFor(modelItem => + item.Phone) + + @Html.DisplayFor(modelItem => + item.Email) +
+ } +
diff --git a/LawFim/LawFirmGuarantorApp/Views/Consultation/CreateConsultation.cshtml b/LawFim/LawFirmGuarantorApp/Views/Consultation/CreateConsultation.cshtml new file mode 100644 index 0000000..33d3e56 --- /dev/null +++ b/LawFim/LawFirmGuarantorApp/Views/Consultation/CreateConsultation.cshtml @@ -0,0 +1,34 @@ +@{ + ViewData["Title"] = "Создание консультацию"; + Layout = "~/Views/Shared/_LayoutGuarantor.cshtml"; +} + +
+

Создание консультации

+
+
+
+
Стоимость консультации
+
+ +
+
+
+
Дата и время
+
+ +
+
+
+
Дело
+
+ +
+
+
+
+
+ +
+
+
diff --git a/LawFim/LawFirmGuarantorApp/Views/Consultation/UpdateConsultation.cshtml b/LawFim/LawFirmGuarantorApp/Views/Consultation/UpdateConsultation.cshtml new file mode 100644 index 0000000..1c8a333 --- /dev/null +++ b/LawFim/LawFirmGuarantorApp/Views/Consultation/UpdateConsultation.cshtml @@ -0,0 +1,34 @@ +@{ + ViewData["Title"] = "Обновление консультации"; + Layout = "~/Views/Shared/_LayoutGuarantor.cshtml"; +} + +
+

Обновление консультации

+
+
+
+
Стоимость
+
+ +
+
+
+
Дата
+
+ +
+
+
+
Дело
+
+ +
+
+
+
+
+ +
+
+
diff --git a/LawFim/LawFirmGuarantorApp/Views/Hearing/AddLawyer.cshtml b/LawFim/LawFirmGuarantorApp/Views/Hearing/AddLawyer.cshtml new file mode 100644 index 0000000..75c9453 --- /dev/null +++ b/LawFim/LawFirmGuarantorApp/Views/Hearing/AddLawyer.cshtml @@ -0,0 +1,30 @@ +@{ + ViewData["Title"] = "Добавить юристов"; + Layout = "~/Views/Shared/_LayoutGuarantor.cshtml"; +} + +
+

Добавить юристов

+
+
+ +
+
Слушание
+
+ +
+
+
+
Юрист
+
+ +
+
+
+
+
+ +
+
+
diff --git a/LawFim/LawFirmGuarantorApp/Views/Hearing/CreateHearing.cshtml b/LawFim/LawFirmGuarantorApp/Views/Hearing/CreateHearing.cshtml new file mode 100644 index 0000000..d8b978c --- /dev/null +++ b/LawFim/LawFirmGuarantorApp/Views/Hearing/CreateHearing.cshtml @@ -0,0 +1,28 @@ +@{ + ViewData["Title"] = "Назначение слушания"; + Layout = "~/Views/Shared/_LayoutGuarantor.cshtml"; +} + +
+

Назначение слушания

+
+
+
+
Дата слушания
+
+ +
+
+
+
Суд
+
+ +
+
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/LawFim/LawFirmGuarantorApp/Views/Hearing/HearingLawyers.cshtml b/LawFim/LawFirmGuarantorApp/Views/Hearing/HearingLawyers.cshtml new file mode 100644 index 0000000..2c24e2c --- /dev/null +++ b/LawFim/LawFirmGuarantorApp/Views/Hearing/HearingLawyers.cshtml @@ -0,0 +1,60 @@ +@using LawFirmContracts.ViewModels; + +@model List +@{ + ViewData["Title"] = "Юристы"; + Layout = "~/Views/Shared/_LayoutGuarantor.cshtml"; +} +
+

Юристы

+
+
+ @{ + if (Model == null) + { +

Авторизируйтесь

+ return; + } + + + + + + + + + + + @foreach (var item in Model) + { + + + + + + + } + +
+ Номер юриста + + ФИО + + Телефон + + Email +
+ @Html.DisplayFor(modelItem => + item.Id) + + @Html.DisplayFor(modelItem => + item.FIO) + + @Html.DisplayFor(modelItem => + item.Phone) + + @Html.DisplayFor(modelItem => + item.Email) +
+ } +
\ No newline at end of file diff --git a/LawFim/LawFirmGuarantorApp/Views/Hearing/UpdateHearing.cshtml b/LawFim/LawFirmGuarantorApp/Views/Hearing/UpdateHearing.cshtml new file mode 100644 index 0000000..3d8b9f0 --- /dev/null +++ b/LawFim/LawFirmGuarantorApp/Views/Hearing/UpdateHearing.cshtml @@ -0,0 +1,28 @@ +@{ + ViewData["Title"] = "UpdateHearing"; + Layout = "~/Views/Shared/_LayoutGuarantor.cshtml"; +} + +
+

Обновление слушания

+
+
+
+
Дата слушания
+
+ +
+
+
+
Суд
+
+ +
+
+
+
+
+ +
+
+
diff --git a/LawFim/LawFirmGuarantorApp/Views/Lawyer/CreateLawyer.cshtml b/LawFim/LawFirmGuarantorApp/Views/Lawyer/CreateLawyer.cshtml new file mode 100644 index 0000000..16c8aa4 --- /dev/null +++ b/LawFim/LawFirmGuarantorApp/Views/Lawyer/CreateLawyer.cshtml @@ -0,0 +1,34 @@ +@{ + ViewData["Title"] = "Создание юриста"; + Layout = "~/Views/Shared/_LayoutGuarantor.cshtml"; +} + +
+

Создание юриста

+
+
+
+
ФИО
+
+ +
+
+
+
Номер телефона
+
+ +
+
+
+
E-mail
+
+ +
+
+
+
+
+ +
+
+
diff --git a/LawFim/LawFirmGuarantorApp/Views/Lawyer/UpdateLawyer.cshtml b/LawFim/LawFirmGuarantorApp/Views/Lawyer/UpdateLawyer.cshtml new file mode 100644 index 0000000..f9a12a5 --- /dev/null +++ b/LawFim/LawFirmGuarantorApp/Views/Lawyer/UpdateLawyer.cshtml @@ -0,0 +1,34 @@ +@{ + ViewData["Title"] = "Обновить юриста"; + Layout = "~/Views/Shared/_LayoutGuarantor.cshtml"; +} + +
+

Изменение юриста

+
+
+
+
ФИО
+
+ +
+
+
+
Номер телефона
+
+ +
+
+
+
E-mail
+
+ +
+
+
+
+
+ +
+
+