ляляля

This commit is contained in:
sofiaivv 2024-05-03 01:38:09 +04:00
parent ed15c81c92
commit 4a24922517
8 changed files with 325 additions and 30 deletions

View File

@ -1,6 +1,45 @@
namespace LawCompanyGuarantorApp
using LawCompanyContracts.ViewModels;
using Newtonsoft.Json;
using System.Net.Http.Headers;
using System.Text;
namespace LawCompanyGuarantorApp
{
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<T>(string requestUrl)
{
var response = _lawyer.GetAsync(requestUrl);
var result = response.Result.Content.ReadAsStringAsync().Result;
if (response.Result.IsSuccessStatusCode)
{
return JsonConvert.DeserializeObject<T>(result);
}
else
{
throw new Exception(result);
}
}
public static void PostRequest<T>(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);
}
}
}
}
}

View File

@ -1,5 +1,61 @@
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
@{
ViewData["Title"] = "Create Consultation";
Layout = "~/Views/Shared/_LayoutGuarantor.cshtml";
}
<div class="text-center">
<h1 class="display-4">Список консультаций</h1>
</div>
<div class="text-center">
@{
<p>
<a asp-controller="Consultation" asp-action="CreateConsultation">Назначить консультацию</a>
<a asp-controller="Consultation" asp-action="AddLawyer">Добавить юристов к консультациям</a>
</p>
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Стоимость консультации
</th>
<th>
Дата консультации
</th>
<th>
Наименование дела
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td id="id">
@Html.DisplayFor(modelItem =>
item.Id)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.Cost)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.CaseName)
</td>
<td>
<button type="submit" class="btn btn-danger">Удалить</button>
</td>
<td>
<button type="submit" class="btn btn-danger">Изменить</button>
</td>
<td>
<button type="submit" class="btn btn-danger">Юристы</button>
</td>
</tr>
}
</tbody>
</table>
}
</div>

View File

@ -1,5 +1,21 @@
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
@{
ViewData["Title"] = "Enter";
Layout = "~/Views/Shared/_LayoutGuarantor.cshtml";
}
<div class="text-center">
<h2 class="display-4">Вход в приложение</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Электронная почта:</div>
<div class="col-8"><input type="text" name="email" /></div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8"><input type="password" name="password" /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Вход" class="btn btnprimary" /></div>
</div>
</form>

View File

@ -1,5 +1,58 @@
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
@{
ViewData["Title"] = "Create Hearing";
Layout = "~/Views/Shared/_LayoutGuarantor.cshtml";
}
<div class="text-center">
<h1 class="display-4">Список слушаний</h1>
</div>
<div class="text-center">
@{
<p>
<a asp-controller="Hearing" asp-action="CreateHearing">Назначить слушание</a>
<a asp-controller="Hearing" asp-action="AddLawyer">Добавить юристов к слушаниям</a>
</p>
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Дата слушания
</th>
<th>
Наименование суда
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td id="id">
@Html.DisplayFor(modelItem =>
item.Id)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.HearingDate)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.Judge)
</td>
<td>
<button type="submit" class="btn btn-danger">Удалить</button>
</td>
<td>
<button type="submit" class="btn btn-danger">Изменить</button>
</td>
<td>
<button type="submit" class="btn btn-danger">Юристы</button>
</td>
</tr>
}
</tbody>
</table>
}
</div>

View File

@ -1,5 +1,67 @@
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
@{
ViewData["Title"] = "Юристы";
Layout = "~/Views/Shared/_LayoutGuarantor.cshtml";
}
<div class="text-center">
<h1 class="display-4">Список юристов</h1>
</div>
<div class="text-center">
@{
if (Model == null)
{
<h3 class="display-4">Авторизируйтесь</h3>
return;
}
<p>
<a asp-controller="Lawyer" asp-action="CreateLawyer">Добавить юриста</a>
</p>
<table class="table">
<thead>
<tr>
<th>
Номер сотрудника
</th>
<th>
ФИО
</th>
<th>
Телефон
</th>
<th>
Email
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td id="id">
@Html.DisplayFor(modelItem =>
item.Id)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.FIO)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.Phone)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.Email)
</td>
<td>
<button type="submit" class="btn btn-danger">Удалить</button>
</td>
<td>
<button type="submit" class="btn btn-danger">Изменить</button>
</td>
</tr>
}
</tbody>
</table>
}
</div>

View File

@ -1,5 +1,36 @@
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
@{
ViewData["Title"] = "Privacy Policy";
Layout = "~/Views/Shared/_LayoutGuarantor.cshtml";
}
<div class="text-center">
<h2 class="display-4">Личные данные</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Электронная почта:</div>
<div class="col-8">
<input type="text" name="email"
value="@Model.Email" />
</div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8">
<input type="password" name="password"
value="@Model.Password" />
</div>
</div>
<div class="row">
<div class="col-4">ФИО:</div>
<div class="col-8">
<input type="text" name="fio"
value="@Model.FIO" />
</div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4">
<input type="submit" value="Сохранить" class="btn btn-primary" />
</div>
</div>
</form>

View File

@ -1,5 +1,28 @@
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
@{
ViewData["Title"] = "Register";
Layout = "~/Views/Shared/_LayoutGuarantor.cshtml";
}
<div class="text-center">
<h2 class="display-4">Регистрация поручителя</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Электронная почта:</div>
<div class="col-8"><input type="text" name="email" /></div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8"><input type="password" name="password" /></div>
</div>
<div class="row">
<div class="col-4">ФИО:</div>
<div class="col-8"><input type="text" name="fio" /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4">
<input type="submit" value="Регистрация"
class="btn btn-primary" />
</div>
</div>
</form>

View File

@ -12,7 +12,7 @@
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container-fluid">
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">LawCompanyGuarantorApp</a>
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Lawyers">LawCompanyGuarantorApp</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
@ -20,10 +20,25 @@
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Lawyers">Home</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Lawyers">Юристы</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Hearings">Слушания</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Consultations">Консультации</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="PrivacyGuarantor">Личные данные</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="RegisterGuarantor">Регистрация</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="EnterGuarantor">Вход</a>
</li>
</ul>
</div>
@ -38,7 +53,7 @@
<footer class="border-top footer text-muted">
<div class="container">
&copy; 2024 - LawCompanyGuarantorApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
&copy; 2024 - LawCompanyGuarantorApp - <a asp-area="" asp-controller="Home" asp-action="PrivacyGuarantor">Privacy</a>
</div>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>