Merge branch 'Stage5' of http://student.git.athene.tech/Zhelovanov_Dmitrii/Pibd-23_Zhelovanov_D.Y._LawFirm_CourceWork into Stage5
This commit is contained in:
commit
a3cdfef49d
@ -13,9 +13,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LawFirmDatabaseImplement",
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LawFirmBusinessLogic", "LawFirmBusinessLogic\LawFirmBusinessLogic.csproj", "{2A063FCC-8DBC-464E-9DF9-5EFC189B357A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LawFirmRestApi", "LawFirmRestApi\LawFirmRestApi.csproj", "{76C4F90F-9C89-4C87-BC59-005116A0C125}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LawFirmRestApi", "LawFirmRestApi\LawFirmRestApi.csproj", "{76C4F90F-9C89-4C87-BC59-005116A0C125}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LawFirmClientApp", "LawFirmClientApp\LawFirmClientApp.csproj", "{6490B18B-2EA0-44C2-96D5-16ECB9DF1259}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LawFirmClientApp", "LawFirmClientApp\LawFirmClientApp.csproj", "{6490B18B-2EA0-44C2-96D5-16ECB9DF1259}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LawFirmManagerApp", "LawFirmManagerApp\LawFirmManagerApp.csproj", "{9EEE6624-8FBF-4197-A6D4-6E5E978DBBCD}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -51,6 +53,10 @@ Global
|
||||
{6490B18B-2EA0-44C2-96D5-16ECB9DF1259}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6490B18B-2EA0-44C2-96D5-16ECB9DF1259}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6490B18B-2EA0-44C2-96D5-16ECB9DF1259}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9EEE6624-8FBF-4197-A6D4-6E5E978DBBCD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9EEE6624-8FBF-4197-A6D4-6E5E978DBBCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9EEE6624-8FBF-4197-A6D4-6E5E978DBBCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9EEE6624-8FBF-4197-A6D4-6E5E978DBBCD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -161,7 +161,6 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
||||
|
||||
}
|
||||
|
||||
|
||||
_logger.LogInformation("Case. CaseID:{ Id}, Name:{ Name}.", model.Id, model.Name);
|
||||
}
|
||||
private bool UpdateStatus(CaseBindingModel model, CaseStatus newStatus)
|
||||
|
119
LawFirm/LawFirmBusinessLogic/BusinessLogics/CompanyLogic.cs
Normal file
119
LawFirm/LawFirmBusinessLogic/BusinessLogics/CompanyLogic.cs
Normal file
@ -0,0 +1,119 @@
|
||||
using LawFirmContracts.BindingModels;
|
||||
using LawFirmContracts.BusinessLogicContracts;
|
||||
using LawFirmContracts.SearchModels;
|
||||
using LawFirmContracts.StoragesContracts;
|
||||
using LawFirmContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LawFirmBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class CompanyLogic:ICompanyLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ICompanyStorage _companyStorage;
|
||||
public CompanyLogic(ILogger<CompanyLogic> logger, ICompanyStorage
|
||||
CompanyStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_companyStorage = CompanyStorage;
|
||||
}
|
||||
public bool Create(CompanyBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_companyStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public bool Delete(CompanyBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_companyStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public CompanyViewModel? ReadElement(CompanySearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. CompanyName:{ Name}. Id:{ Id}", model.Name, model.Id);
|
||||
var element = _companyStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public List<CompanyViewModel>? ReadList(CompanySearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. CompanyName:{Name}.Id:{ Id}", model?.Name, model?.Id);
|
||||
var list = model == null ? _companyStorage.GetFullList() :
|
||||
_companyStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool Update(CompanyBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_companyStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(CompanyBindingModel model, bool withParams =
|
||||
true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Name))
|
||||
{
|
||||
throw new ArgumentNullException("Нет имени роли",
|
||||
nameof(model.Name));
|
||||
}
|
||||
|
||||
_logger.LogInformation("Company. CompanyName:{ Name}. Id: { Id} ", model.Name, model.Id);
|
||||
var element = _companyStorage.GetElement(new CompanySearchModel
|
||||
{
|
||||
Name = model.Name
|
||||
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Компания с такими данными уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -15,11 +15,6 @@ namespace LawFirmClientApp.Controllers
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IActionResult StartView()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// СТРАНИЦА ДЕЛ
|
||||
public IActionResult Cases()
|
||||
{
|
||||
@ -31,41 +26,6 @@ namespace LawFirmClientApp.Controllers
|
||||
View(APIClient.GetRequest<List<CaseViewModel>>($"api/case/getcaselist?companyid={APIClient.User.CompanyId}"));
|
||||
}
|
||||
|
||||
// СТРАНИЦЫ КОНСУЛЬТАЦИЙ
|
||||
|
||||
public IActionResult Consultations()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/EnterManager");
|
||||
}
|
||||
return
|
||||
View(APIClient.GetRequest<List<ConsultationViewModel>>($"api/consultation/getconsultationlist?companyid={APIClient.User.CompanyId}"));
|
||||
}
|
||||
|
||||
// СТРАНИЦА СЛУШАНИЙ
|
||||
|
||||
public IActionResult Hearings()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/EnterManager");
|
||||
}
|
||||
return
|
||||
View(APIClient.GetRequest<List<HearingViewModel>>($"api/hearing/gethearinglist?companyid={APIClient.User.CompanyId}"));
|
||||
}
|
||||
|
||||
// СТРАНИЦА ЮРИСТОВ
|
||||
public IActionResult Lawyers()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/EnterManager");
|
||||
}
|
||||
return
|
||||
View(APIClient.GetRequest<List<LawyerViewModel>>($"api/lawyer/getlawyerlist?companyid={APIClient.User.CompanyId}"));
|
||||
}
|
||||
|
||||
// СТРАНИЦА КЛИЕНТОВ
|
||||
public IActionResult Clients()
|
||||
{
|
||||
@ -106,10 +66,11 @@ namespace LawFirmClientApp.Controllers
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Companies = APIClient.GetRequest<List<CompanyViewModel>>($"api/company/getcompanylist");
|
||||
return View(APIClient.User);
|
||||
}
|
||||
[HttpPost]
|
||||
public void PrivacyLawyer(string login, string password, string fio, string company)
|
||||
public void PrivacyLawyer(string login, string password, string fio, int companyid)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
@ -127,62 +88,26 @@ namespace LawFirmClientApp.Controllers
|
||||
FIO = fio,
|
||||
Email = login,
|
||||
Password = password,
|
||||
CompanyId = company
|
||||
CompanyId = companyid
|
||||
|
||||
});
|
||||
APIClient.User.FIO = fio;
|
||||
APIClient.User.Email = login;
|
||||
APIClient.User.Password = password;
|
||||
APIClient.User.CompanyId = companyid;
|
||||
Response.Redirect("Cases");
|
||||
}
|
||||
|
||||
// ЛИЧНЫЕ ДАННЫЕ ПОРУЧИТЕЛЯ
|
||||
[HttpGet]
|
||||
public IActionResult PrivacyManager()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/EnterLawyer");
|
||||
}
|
||||
return View(APIClient.User);
|
||||
}
|
||||
[HttpPost]
|
||||
public void PrivacyManager(string login, string password, string fio)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
if (string.IsNullOrEmpty(login) ||
|
||||
string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
|
||||
{
|
||||
throw new Exception("Введите логин, пароль и ФИО");
|
||||
}
|
||||
APIClient.PostRequest("api/usermanager/updatedata", new
|
||||
UserBindingModel
|
||||
{
|
||||
Id = APIClient.User.Id,
|
||||
FIO = fio,
|
||||
Email = login,
|
||||
Password = password,
|
||||
|
||||
|
||||
});
|
||||
APIClient.User.FIO = fio;
|
||||
APIClient.User.Email = login;
|
||||
APIClient.User.Password = password;
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
|
||||
// РЕГИСТРАЦИЯ ЮРИСТА
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult RegisterLawyer()
|
||||
{
|
||||
ViewBag.Companies = APIClient.GetRequest<List<CompanyViewModel>>($"api/company/getcompanylist");
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void RegisterLawyer(string login, string password, string fio)
|
||||
public void RegisterLawyer(string login, string password, string fio, int companyid)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) ||
|
||||
string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
|
||||
@ -197,53 +122,13 @@ namespace LawFirmClientApp.Controllers
|
||||
FIO = fio,
|
||||
Email = login,
|
||||
Password = password,
|
||||
CompanyId = companyid
|
||||
|
||||
});
|
||||
Response.Redirect("EnterLawyer");
|
||||
return;
|
||||
}
|
||||
|
||||
// РЕГИСТРАЦИЯ ПОРУЧИТЕЛЯ
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult RegisterManager()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void RegisterManager(string login, string password, string fio)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) ||
|
||||
string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
|
||||
{
|
||||
throw new Exception("Введите логин, пароль и ФИО");
|
||||
}
|
||||
char[] letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();
|
||||
Random rand = new Random();
|
||||
// Сделайте слово.
|
||||
string word = "";
|
||||
for (int j = 1; j <= 10; j++)
|
||||
{
|
||||
// Выбор случайного числа от 0 до 25
|
||||
// для выбора буквы из массива букв.
|
||||
int letter_num = rand.Next(0, letters.Length-1);
|
||||
|
||||
// Добавить письмо.
|
||||
word += letters[letter_num];
|
||||
}
|
||||
APIClient.PostRequest("api/usermanager/register", new
|
||||
UserBindingModel
|
||||
{
|
||||
RoleId = 2,
|
||||
FIO = fio,
|
||||
Email = login,
|
||||
Password = password,
|
||||
CompanyId = word
|
||||
|
||||
});
|
||||
Response.Redirect("EnterManager");
|
||||
return;
|
||||
}
|
||||
// ВХОД ДЛЯ ЮРИСТА
|
||||
|
||||
[HttpGet]
|
||||
@ -252,17 +137,14 @@ namespace LawFirmClientApp.Controllers
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void EnterLawyer(string login, string password, string company)
|
||||
public void EnterLawyer(string login, string password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) ||
|
||||
string.IsNullOrEmpty(password))
|
||||
{
|
||||
throw new Exception("Введите логин и пароль");
|
||||
}
|
||||
|
||||
APIClient.User =
|
||||
APIClient.GetRequest<UserViewModel>($"api/userlawyer/login?login={login}&password={password}");
|
||||
|
||||
APIClient.User = APIClient.GetRequest<UserViewModel>($"api/userlawyer/login?login={login}&password={password}");
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
|
||||
@ -271,51 +153,7 @@ namespace LawFirmClientApp.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
if (APIClient.User.RoleId == 1) {
|
||||
APIClient.PostRequest("api/usermanager/updatedata", new
|
||||
UserBindingModel
|
||||
{
|
||||
Id = APIClient.User.Id,
|
||||
FIO = APIClient.User.FIO,
|
||||
Email = login,
|
||||
Password = password,
|
||||
CompanyId = company
|
||||
|
||||
|
||||
});
|
||||
APIClient.User.CompanyId = company;
|
||||
Response.Redirect("/Home/Cases"); }
|
||||
else throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
// ВХОД ДЛЯ ПОРУЧИТЕЛЯ
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult EnterManager()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void EnterManager(string login, string password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) ||
|
||||
string.IsNullOrEmpty(password))
|
||||
{
|
||||
throw new Exception("Введите логин и пароль");
|
||||
}
|
||||
APIClient.User = APIClient.GetRequest<UserViewModel>($"api/usermanager/login?login={login}&password={password}");
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
|
||||
Response.Redirect("EnterLawyer");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (APIClient.User.RoleId == 2) { Response.Redirect("/Home/Lawyers"); }
|
||||
if (APIClient.User.RoleId == 1) { Response.Redirect("/Home/Cases"); }
|
||||
else throw new Exception();
|
||||
}
|
||||
}
|
||||
|
@ -23,11 +23,4 @@
|
||||
<ProjectReference Include="..\LawFirmDatabaseImplement\LawFirmDatabaseImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="Views\Consultation\CreateConsultation.cshtml">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -33,6 +33,6 @@ app.UseAuthorization();
|
||||
|
||||
app.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=StartView}/{id?}");
|
||||
pattern: "{controller=Home}/{action=EnterLawyer}/{id?}");
|
||||
|
||||
app.Run();
|
||||
|
@ -14,10 +14,6 @@
|
||||
<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="company" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Вход" class="btn btnprimary" /></div>
|
||||
|
@ -29,6 +29,16 @@
|
||||
value="@Model.FIO" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Компания:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="company"
|
||||
value=@Html.DisplayFor(modelitem => Model.CompanyName) />
|
||||
<div>Изменить компанию:</div>
|
||||
<select id="companyid" name="companyid" class="form-control col-4" style="width: 30%;" asp-items="@(new SelectList(@ViewBag.Companies, "Id", "Name"))"></select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
|
@ -18,7 +18,12 @@
|
||||
<div class="col-4">ФИО:</div>
|
||||
<div class="col-8"><input type="text" name="fio" /></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-4">Название компании</div>
|
||||
<div class="col-8">
|
||||
<select id="companyid" name="companyid" class="form-control" asp-items="@(new SelectList(@ViewBag.Companies, "Id", "Name"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
|
@ -1,15 +0,0 @@
|
||||
@{
|
||||
ViewData["Title"] = "Start Page";
|
||||
Layout = "_LayoutStart";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Выберите Роль</h2>
|
||||
</div>
|
||||
<div class="d-grid gap-2 col-6 mx-auto">
|
||||
<button type="button" class="btn btn-outline-primary btn-lg">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="RegisterManager">Поручитель</a>
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-primary btn-lg">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="RegisterLawyer">Исполнитель</a>
|
||||
</button>
|
||||
</div>
|
@ -1,8 +0,0 @@
|
||||
@*
|
||||
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
*@
|
||||
@{
|
||||
ViewData["Title"] = "Start Page";
|
||||
Layout = "~/Views/Shared/_LayoutManager.cshtml";
|
||||
}
|
||||
<h2>Проверка</h2>
|
@ -1,36 +0,0 @@
|
||||
@{
|
||||
ViewData["Title"] = "Privacy Policy";
|
||||
}
|
||||
<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="login"
|
||||
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.ClientFIO" />
|
||||
</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>
|
@ -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="StartView">LawFirmClientApp</a>
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Cases">LawFirmClientApp</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>
|
||||
|
@ -1,29 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - LawFirmClientApp</title>
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/LawFirmClientApp.styles.css" asp-append-version="true" />
|
||||
</head>
|
||||
<body>
|
||||
<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="StartView">LawFirmClientApp</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>
|
||||
</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="container">
|
||||
<main role="main" class="pb-3">
|
||||
@RenderBody()
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,3 +1,3 @@
|
||||
@{
|
||||
Layout = "_LayoutStart";
|
||||
Layout = "_LayoutIspol";
|
||||
}
|
||||
|
@ -22,6 +22,6 @@ namespace LawFirmContracts.BindingModels
|
||||
|
||||
public Dictionary<int, IClientModel> CaseClients { get; set; } = new();
|
||||
|
||||
public string? CompanyId { get; set; } = string.Empty;
|
||||
public int? CompanyId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,6 @@ namespace LawFirmContracts.BindingModels
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
public string? CompanyId { get; set; } = string.Empty;
|
||||
public int? CompanyId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
using LawFirmDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LawFirmContracts.BindingModels
|
||||
{
|
||||
public class CompanyBindingModel:ICompanyModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -15,6 +15,6 @@ namespace LawFirmContracts.BindingModels
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public string? CompanyId { get; set; } = string.Empty;
|
||||
public int? CompanyId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,6 @@ namespace LawFirmContracts.BindingModels
|
||||
|
||||
public int Id { get; set; }
|
||||
public int CaseId { get; set; }
|
||||
public string? CompanyId { get; set; } = string.Empty;
|
||||
public int? CompanyId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,6 @@ namespace LawFirmContracts.BindingModels
|
||||
public string Post { get; set; } = string.Empty;
|
||||
|
||||
public int Id { get; set; }
|
||||
public string? CompanyId { get; set; } = string.Empty;
|
||||
public int? CompanyId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,6 @@ namespace LawFirmContracts.BindingModels
|
||||
public List<ClientViewModel>? Clients { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
public string? CompanyId { get; set; } = string.Empty;
|
||||
public int? CompanyId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -15,9 +15,8 @@ namespace LawFirmContracts.BindingModels
|
||||
public string Email { get; set; }= string.Empty;
|
||||
|
||||
public string Password { get; set; }= string.Empty;
|
||||
|
||||
public int RoleId { get; set; }
|
||||
public string? CompanyId { get; set; } = string.Empty;
|
||||
public int CompanyId { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,6 @@ namespace LawFirmContracts.BindingModels
|
||||
public int ConsultationId { get; set; }
|
||||
public Dictionary<int, IClientModel> VisitClients { get; set; } = new();
|
||||
|
||||
public string? CompanyId { get; set; } = string.Empty;
|
||||
public int? CompanyId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
using LawFirmContracts.BindingModels;
|
||||
using LawFirmContracts.SearchModels;
|
||||
using LawFirmContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LawFirmContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface ICompanyLogic
|
||||
{
|
||||
List<CompanyViewModel>? ReadList(CompanySearchModel? model);
|
||||
CompanyViewModel? ReadElement(CompanySearchModel model);
|
||||
bool Create(CompanyBindingModel model);
|
||||
bool Update(CompanyBindingModel model);
|
||||
bool Delete(CompanyBindingModel model);
|
||||
}
|
||||
}
|
@ -12,6 +12,6 @@ namespace LawFirmContracts.SearchModels
|
||||
public string? Name { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
public string? CompanyId { get; set; }
|
||||
public int? CompanyId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,6 @@ namespace LawFirmContracts.SearchModels
|
||||
public string? FIO { get; set; }
|
||||
public string? Phone { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? CompanyId { get; set; }
|
||||
public int? CompanyId { get; set; }
|
||||
}
|
||||
}
|
||||
|
14
LawFirm/LawFirmContracts/SearchModels/CompanySearchModel.cs
Normal file
14
LawFirm/LawFirmContracts/SearchModels/CompanySearchModel.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LawFirmContracts.SearchModels
|
||||
{
|
||||
public class CompanySearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
}
|
@ -9,6 +9,6 @@ namespace LawFirmContracts.SearchModels
|
||||
public class ConsultationSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? CompanyId { get; set; }
|
||||
public int? CompanyId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace LawFirmContracts.SearchModels
|
||||
public DateTime? HearingDate { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
public string? CompanyId { get; set; }
|
||||
public int? CompanyId { get; set; }
|
||||
public int? CaseId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,6 @@ namespace LawFirmContracts.SearchModels
|
||||
public int? Id { get; set; }
|
||||
public string? FIO { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? CompanyId { get; set; }
|
||||
public int? CompanyId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,6 @@ namespace LawFirmContracts.SearchModels
|
||||
public string? Email { get; set; }
|
||||
public string? Password { get; set; }
|
||||
public int? RoleId { get; set; }
|
||||
public string? CompanyId { get; set; }
|
||||
public int? CompanyId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace LawFirmContracts.SearchModels
|
||||
public int? ConsultationId { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
public string? CompanyId { get; set; }
|
||||
public int? CompanyId { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
using LawFirmContracts.BindingModels;
|
||||
using LawFirmContracts.SearchModels;
|
||||
using LawFirmContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LawFirmContracts.StoragesContracts
|
||||
{
|
||||
public interface ICompanyStorage
|
||||
{
|
||||
List<CompanyViewModel> GetFullList();
|
||||
List<CompanyViewModel> GetFilteredList(CompanySearchModel model);
|
||||
CompanyViewModel? GetElement(CompanySearchModel model);
|
||||
CompanyViewModel? Insert(CompanyBindingModel model);
|
||||
CompanyViewModel? Update(CompanyBindingModel model);
|
||||
CompanyViewModel? Delete(CompanyBindingModel model);
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@ namespace LawFirmContracts.ViewModels
|
||||
[DisplayName("Дата статус")]
|
||||
public CaseStatus Status { get; set; } = CaseStatus.Неизвестен;
|
||||
public Dictionary<int, IClientModel> CaseClients { get; set; } = new();
|
||||
public string? CompanyId { get; set; } = string.Empty;
|
||||
public int? CompanyId { get; set; }
|
||||
public CaseViewModel() { }
|
||||
|
||||
[JsonConstructor]
|
||||
|
@ -18,6 +18,6 @@ namespace LawFirmContracts.ViewModels
|
||||
public string Email { get; set; } = string.Empty;
|
||||
[DisplayName("Телефон клиента")]
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
public string? CompanyId { get; set; } = string.Empty;
|
||||
public int? CompanyId { get; set; }
|
||||
}
|
||||
}
|
||||
|
17
LawFirm/LawFirmContracts/ViewModels/CompanyViewModel.cs
Normal file
17
LawFirm/LawFirmContracts/ViewModels/CompanyViewModel.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using LawFirmDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LawFirmContracts.ViewModels
|
||||
{
|
||||
public class CompanyViewModel : ICompanyModel
|
||||
{
|
||||
[DisplayName("Имя компании")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
@ -14,6 +14,6 @@ namespace LawFirmContracts.ViewModels
|
||||
[DisplayName("Цена консультации")]
|
||||
public double Cost { get; set; }
|
||||
public int Id { get; set; }
|
||||
public string? CompanyId { get; set; } = string.Empty;
|
||||
public int? CompanyId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace LawFirmContracts.ViewModels
|
||||
[DisplayName("Дело")]
|
||||
public string CaseName { get; set; } = string.Empty;
|
||||
public int CaseId { get; set; }
|
||||
public string? CompanyId { get; set; } = string.Empty;
|
||||
public int? CompanyId { get; set; }
|
||||
public Dictionary<int, ILawyerModel> HearingLawyers { get; set; } = new();
|
||||
public HearingViewModel() { }
|
||||
|
||||
|
@ -19,6 +19,6 @@ namespace LawFirmContracts.ViewModels
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
[DisplayName("Должность юриста")]
|
||||
public string Post { get; set; } = string.Empty;
|
||||
public string? CompanyId { get; set; } = string.Empty;
|
||||
public int? CompanyId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ namespace LawFirmContracts.ViewModels
|
||||
public string Password { get; set; } = string.Empty;
|
||||
[DisplayName("Роль клиента")]
|
||||
public string RoleName { get; set; } = string.Empty;
|
||||
public string? CompanyId { get; set; } = string.Empty;
|
||||
public int CompanyId { get; set; }
|
||||
[DisplayName("Компания")]
|
||||
public string CompanyName { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace LawFirmContracts.ViewModels
|
||||
public DateTime VisitDate { get; set; }
|
||||
public int ConsultationId { get; set; }
|
||||
public Dictionary<int, IClientModel> VisitClients { get; set; } = new();
|
||||
public string? CompanyId { get; set; } = string.Empty;
|
||||
public int? CompanyId { get; set; }
|
||||
public VisitViewModel() { }
|
||||
|
||||
[JsonConstructor]
|
||||
|
@ -14,6 +14,6 @@ namespace LawFirmDataModels.Models
|
||||
DateTime DateCreate { get; }
|
||||
DateTime? DateImplement { get; }
|
||||
CaseStatus Status { get; }
|
||||
public string? CompanyId { get; }
|
||||
public int? CompanyId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,6 @@ namespace LawFirmDataModels.Models
|
||||
string FIO { get; }
|
||||
string Email { get; }
|
||||
string Phone { get; }
|
||||
public string? CompanyId { get; }
|
||||
public int? CompanyId { get; }
|
||||
}
|
||||
}
|
||||
|
13
LawFirm/LawFirmDataModels/Models/ICompanyModel.cs
Normal file
13
LawFirm/LawFirmDataModels/Models/ICompanyModel.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LawFirmDataModels.Models
|
||||
{
|
||||
public interface ICompanyModel:IId
|
||||
{
|
||||
string Name { get; }
|
||||
}
|
||||
}
|
@ -10,6 +10,6 @@ namespace LawFirmDataModels.Models
|
||||
{
|
||||
Dictionary<int, ILawyerModel> ConsultationLawyers { get; }
|
||||
double Cost { get; }
|
||||
public string? CompanyId { get; }
|
||||
public int? CompanyId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,6 @@ namespace LawFirmDataModels.Models
|
||||
string Court { get; }
|
||||
string Judge { get; }
|
||||
Dictionary<int, ILawyerModel> HearingLawyers { get; }
|
||||
public string? CompanyId { get; }
|
||||
public int? CompanyId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,6 @@ namespace LawFirmDataModels.Models
|
||||
string Email { get; }
|
||||
string Phone { get; }
|
||||
string Post { get; }
|
||||
public string? CompanyId { get; }
|
||||
public int? CompanyId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,6 @@ namespace LawFirmDataModels.Models
|
||||
string Email { get; }
|
||||
string Password { get; }
|
||||
int RoleId { get; }
|
||||
public string? CompanyId { get; }
|
||||
public int CompanyId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,6 @@ namespace LawFirmDataModels.Models
|
||||
Dictionary<int, IClientModel> VisitClients { get; }
|
||||
DateTime VisitDate { get; }
|
||||
int ConsultationId { get; }
|
||||
public string? CompanyId { get; }
|
||||
public int? CompanyId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -26,17 +26,17 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
public List<CaseViewModel> GetFilteredList(CaseSearchModel model)
|
||||
{
|
||||
if (!model.DateFrom.HasValue && !model.DateTo.HasValue
|
||||
&& string.IsNullOrEmpty(model.CompanyId))
|
||||
&& !model.CompanyId.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(model.CompanyId))
|
||||
if (model.CompanyId.HasValue)
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Cases
|
||||
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
||||
.Where(x => x.CompanyId.Equals(model.CompanyId)).ToList()
|
||||
.Where(x => x.CompanyId == model.CompanyId).ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -61,7 +61,7 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
}
|
||||
public CaseViewModel? GetElement(CaseSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue && string.IsNullOrEmpty(model.CompanyId) && string.IsNullOrEmpty(model.Name))
|
||||
if (!model.Id.HasValue && !model.CompanyId.HasValue && string.IsNullOrEmpty(model.Name))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue && string.IsNullOrEmpty(model.FIO)
|
||||
&& string.IsNullOrEmpty(model.Phone) && string.IsNullOrEmpty(model.CompanyId))
|
||||
&& string.IsNullOrEmpty(model.Phone) && !model.CompanyId.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
@ -39,11 +39,11 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(model.CompanyId))
|
||||
else if (model.CompanyId.HasValue)
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Clients
|
||||
.Where(x => x.CompanyId.Equals(model.CompanyId))
|
||||
.Where(x => x.CompanyId == model.CompanyId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -59,7 +59,7 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
public ClientViewModel? GetElement(ClientSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue && string.IsNullOrEmpty(model.FIO)
|
||||
&& string.IsNullOrEmpty(model.Phone) && string.IsNullOrEmpty(model.CompanyId))
|
||||
&& string.IsNullOrEmpty(model.Phone) && !model.CompanyId.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@ -67,7 +67,7 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
|
||||
return context.Clients
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Email)
|
||||
&& x.Email == model.Email) || (model.Id.HasValue && x.Id == model.Id) || (!string.IsNullOrEmpty(model.CompanyId)
|
||||
&& x.Email == model.Email) || (model.Id.HasValue && x.Id == model.Id) || (model.CompanyId.HasValue
|
||||
&& x.CompanyId == model.CompanyId))
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
@ -0,0 +1,89 @@
|
||||
using LawFirmContracts.BindingModels;
|
||||
using LawFirmContracts.SearchModels;
|
||||
using LawFirmContracts.StoragesContracts;
|
||||
using LawFirmContracts.ViewModels;
|
||||
using LawFirmDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LawFirmDatabaseImplement.Implements
|
||||
{
|
||||
public class CompanyStorage:ICompanyStorage
|
||||
{
|
||||
public List<CompanyViewModel> GetFullList()
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Companies
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<CompanyViewModel> GetFilteredList(CompanySearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Name))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Companies
|
||||
.Where(x => x.Name.Contains(model.Name))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
|
||||
}
|
||||
public CompanyViewModel? GetElement(CompanySearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Name) &&
|
||||
!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Companies
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Name) &&
|
||||
x.Name == model.Name) ||
|
||||
(model.Id.HasValue && x.Id ==
|
||||
model.Id))
|
||||
?.GetViewModel;
|
||||
}
|
||||
public CompanyViewModel? Insert(CompanyBindingModel model)
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
var newCompany = Company.Create(context, model);
|
||||
if (newCompany == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Companies.Add(newCompany);
|
||||
context.SaveChanges();
|
||||
return newCompany.GetViewModel;
|
||||
}
|
||||
public CompanyViewModel? Update(CompanyBindingModel model)
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
var company = context.Companies.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (company == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
company.Update(model);
|
||||
context.SaveChanges();
|
||||
return company.GetViewModel;
|
||||
}
|
||||
public CompanyViewModel? Delete(CompanyBindingModel model)
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
var element = context.Companies.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Companies.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -27,17 +27,17 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
}
|
||||
public List<ConsultationViewModel> GetFilteredList(ConsultationSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue && string.IsNullOrEmpty(model.CompanyId))
|
||||
if (!model.Id.HasValue && !model.CompanyId.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
if (!string.IsNullOrEmpty(model.CompanyId))
|
||||
if (model.CompanyId.HasValue)
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Consultations
|
||||
.Include(x => x.Lawyers)
|
||||
.ThenInclude(x => x.Lawyer)
|
||||
.Where(x => x.CompanyId.Equals(model.CompanyId))
|
||||
.Where(x => x.CompanyId == model.CompanyId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
}
|
||||
public ConsultationViewModel? GetElement(ConsultationSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue && string.IsNullOrEmpty(model.CompanyId))
|
||||
if (!model.Id.HasValue && !model.CompanyId.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@ -63,7 +63,7 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
.Include(x => x.Lawyers)
|
||||
.ThenInclude(x => x.Lawyer)
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id)
|
||||
|| (!string.IsNullOrEmpty(model.CompanyId)
|
||||
|| (model.CompanyId.HasValue
|
||||
&& x.CompanyId == model.CompanyId))?.GetViewModel;
|
||||
}
|
||||
public ConsultationViewModel? Insert(ConsultationBindingModel model)
|
||||
|
@ -25,15 +25,15 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
public List<HearingViewModel> GetFilteredList(HearingSearchModel model)
|
||||
{
|
||||
if (!model.HearingDate.HasValue && !model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue
|
||||
&& string.IsNullOrEmpty(model.CompanyId))
|
||||
&& !model.CompanyId.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
if (!string.IsNullOrEmpty(model.CompanyId))
|
||||
if (model.CompanyId.HasValue)
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Hearings
|
||||
.Where(x => x.CompanyId.Equals(model.CompanyId))
|
||||
.Where(x => x.CompanyId == model.CompanyId)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.Select(y => { y.CaseName = context.Cases.FirstOrDefault(x => x.Id == y.CaseId).Name; return y; })
|
||||
@ -61,14 +61,14 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
}
|
||||
public HearingViewModel? GetElement(HearingSearchModel model)
|
||||
{
|
||||
if (!model.HearingDate.HasValue && !model.Id.HasValue && string.IsNullOrEmpty(model.CompanyId))
|
||||
if (!model.HearingDate.HasValue && !model.Id.HasValue && !model.CompanyId.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new LawFirmDatabase();
|
||||
return AccessHearingStorage(context.Hearings
|
||||
.FirstOrDefault(x => (model.Id.HasValue
|
||||
&& x.Id == model.Id) || (!string.IsNullOrEmpty(model.CompanyId)
|
||||
&& x.Id == model.Id) || (model.CompanyId.HasValue
|
||||
&& x.CompanyId == model.CompanyId))
|
||||
?.GetViewModel, context);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
public List<LawyerViewModel> GetFilteredList(LawyerSearchModel
|
||||
model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue && string.IsNullOrEmpty(model.CompanyId) && string.IsNullOrEmpty(model.FIO))
|
||||
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue && !model.CompanyId.HasValue && string.IsNullOrEmpty(model.FIO))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
@ -36,7 +36,7 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(model.CompanyId))
|
||||
else if (model.CompanyId.HasValue)
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Lawyers
|
||||
@ -55,14 +55,14 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
}
|
||||
public LawyerViewModel? GetElement(LawyerSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue && string.IsNullOrEmpty(model.CompanyId)
|
||||
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue && !model.CompanyId.HasValue
|
||||
&& string.IsNullOrEmpty(model.FIO))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Lawyers
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id) || (!string.IsNullOrEmpty(model.CompanyId) && x.CompanyId == model.CompanyId))
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id) || (model.CompanyId.HasValue && x.CompanyId == model.CompanyId))
|
||||
?.GetViewModel;
|
||||
}
|
||||
public LawyerViewModel? Insert(LawyerBindingModel model)
|
||||
|
@ -1,4 +1,5 @@
|
||||
using LawFirmContracts.BindingModels;
|
||||
using DocumentFormat.OpenXml.Bibliography;
|
||||
using LawFirmContracts.BindingModels;
|
||||
using LawFirmContracts.SearchModels;
|
||||
using LawFirmContracts.StoragesContracts;
|
||||
using LawFirmContracts.ViewModels;
|
||||
@ -17,23 +18,29 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
public List<UserViewModel> GetFullList()
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Users.Include(x => x.Role)
|
||||
return context.Users
|
||||
.Include(x => x.Role)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
.Select(y => { y.CompanyName = context.Companies.FirstOrDefault(x => x.Id == y.CompanyId).Name; return y; })
|
||||
.ToList();
|
||||
}
|
||||
public List<UserViewModel> GetFilteredList(UserSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Email) && string.IsNullOrEmpty(model.Password) && !model.Id.HasValue &&
|
||||
string.IsNullOrEmpty(model.CompanyId))
|
||||
!model.CompanyId.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
if (!string.IsNullOrEmpty(model.Email) && !string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Users.Include(x => x.Role)
|
||||
return context.Users
|
||||
.Include(x => x.Role)
|
||||
.Where(x => x.Email.Equals(model.Email) && x.Password.Equals(model.Email))
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.Select(y => { y.CompanyName = context.Companies.FirstOrDefault(x => x.Id == y.CompanyId).Name; return y; })
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
@ -41,22 +48,24 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Users.Include(x => x.Role)
|
||||
.Where(x => x.Id == model.Id)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.Select(y => { y.CompanyName = context.Companies.FirstOrDefault(x => x.Id == y.CompanyId).Name; return y; })
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
public UserViewModel? GetElement(UserSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue && string.IsNullOrEmpty(model.CompanyId))
|
||||
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue && !model.CompanyId.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Users
|
||||
return AccessUserStorage( context.Users
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Email) && x.Email == model.Email) ||
|
||||
(model.Id.HasValue && x.Id == model.Id) || (!string.IsNullOrEmpty(model.CompanyId)
|
||||
(model.Id.HasValue && x.Id == model.Id) || (!model.CompanyId.HasValue
|
||||
&& x.CompanyId == model.CompanyId))
|
||||
?.GetViewModel;
|
||||
?.GetViewModel, context);
|
||||
}
|
||||
public UserViewModel? Insert(UserBindingModel model)
|
||||
{
|
||||
@ -94,5 +103,12 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
static UserViewModel AccessUserStorage(UserViewModel model, LawFirmDatabase context)
|
||||
{
|
||||
if (model == null) return model;
|
||||
string? dishName = context.Companies.FirstOrDefault(x => x.Id == model.CompanyId)?.Name;
|
||||
if (dishName != null) model.CompanyName = dishName;
|
||||
return model;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,17 +26,17 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
}
|
||||
public List<VisitViewModel> GetFilteredList(VisitSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue && string.IsNullOrEmpty(model.CompanyId)
|
||||
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue && !model.CompanyId.HasValue
|
||||
&& !model.VisitDate.HasValue && !model.ConsultationId.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
if (!string.IsNullOrEmpty(model.CompanyId))
|
||||
if (model.CompanyId.HasValue)
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Visits
|
||||
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
||||
.Where(x => x.CompanyId.Equals(model.CompanyId))
|
||||
.Where(x => x.CompanyId == model.CompanyId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -61,7 +61,7 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
}
|
||||
public List<VisitViewModel> GetFilteredDateList(VisitSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue && string.IsNullOrEmpty(model.CompanyId))
|
||||
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue && !model.CompanyId.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
@ -87,7 +87,7 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
}
|
||||
public VisitViewModel? GetElement(VisitSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue && string.IsNullOrEmpty(model.CompanyId)
|
||||
if (!model.Id.HasValue && !model.CompanyId.HasValue
|
||||
&& !model.VisitDate.HasValue && !model.ConsultationId.HasValue)
|
||||
{
|
||||
return new();
|
||||
@ -95,7 +95,7 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Visits.Include(x => x.Clients).ThenInclude(x => x.Client)
|
||||
.FirstOrDefault(x => (model.ConsultationId.HasValue && x.ConsultationId == model.ConsultationId) || (model.Id.HasValue
|
||||
&& x.Id == model.Id) || (!string.IsNullOrEmpty(model.CompanyId)
|
||||
&& x.Id == model.Id) || (model.CompanyId.HasValue
|
||||
&& x.CompanyId == model.CompanyId))
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
@ -17,11 +17,11 @@ namespace LawFirmDatabaseImplement
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
|
||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-ON2V3BB\SQLEXPRESS;Initial Catalog=LawFirmDatabase;
|
||||
Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
// optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-ON2V3BB\SQLEXPRESS;Initial Catalog=LawFirmDatabase;
|
||||
//Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
|
||||
//optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-7A1PHA0\SQLEXPRESS;Initial Catalog=LawFirmDatabase;
|
||||
//Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-7A1PHA0\SQLEXPRESS;Initial Catalog=LawFirmDatabase;
|
||||
Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
@ -37,5 +37,6 @@ namespace LawFirmDatabaseImplement
|
||||
public virtual DbSet<ConsultationLawyer> ConsultationLawyers { set; get; }
|
||||
public virtual DbSet<User> Users { set; get; }
|
||||
public virtual DbSet<Role> Roles { set; get; }
|
||||
}
|
||||
public virtual DbSet<Company> Companies { set; get; }
|
||||
}
|
||||
}
|
||||
|
522
LawFirm/LawFirmDatabaseImplement/Migrations/20230524095015_AddCompany.Designer.cs
generated
Normal file
522
LawFirm/LawFirmDatabaseImplement/Migrations/20230524095015_AddCompany.Designer.cs
generated
Normal file
@ -0,0 +1,522 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using LawFirmDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LawFirmDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(LawFirmDatabase))]
|
||||
[Migration("20230524095015_AddCompany")]
|
||||
partial class AddCompany
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Cases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.CaseClient", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("CaseClients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Company", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Companies");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Consultation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Consultations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.ConsultationLawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ConsultationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ConsultationId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("ConsultationLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Court")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("HearingDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Judge")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.ToTable("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.HearingLawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("HearingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("HearingId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("HearingLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Post")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Role", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Roles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CompanyId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Visit", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ConsultationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("VisitDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ConsultationId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Visits");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.VisitClient", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("VisitId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.HasIndex("VisitId");
|
||||
|
||||
b.ToTable("VisitClients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.CaseClient", b =>
|
||||
{
|
||||
b.HasOne("LawFirmDatabaseImplement.Models.Case", "Case")
|
||||
.WithMany("Clients")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawFirmDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("CaseClients")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.ConsultationLawyer", b =>
|
||||
{
|
||||
b.HasOne("LawFirmDatabaseImplement.Models.Consultation", "Consultation")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("ConsultationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawFirmDatabaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("ConsultationLawyers")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Consultation");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.HasOne("LawFirmDatabaseImplement.Models.Case", "Case")
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.HearingLawyer", b =>
|
||||
{
|
||||
b.HasOne("LawFirmDatabaseImplement.Models.Hearing", "Hearing")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("HearingId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawFirmDatabaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("HearingLawyers")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Hearing");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.User", b =>
|
||||
{
|
||||
b.HasOne("LawFirmDatabaseImplement.Models.Company", "Company")
|
||||
.WithMany("Users")
|
||||
.HasForeignKey("CompanyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawFirmDatabaseImplement.Models.Role", "Role")
|
||||
.WithMany("Users")
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Company");
|
||||
|
||||
b.Navigation("Role");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Visit", b =>
|
||||
{
|
||||
b.HasOne("LawFirmDatabaseImplement.Models.Consultation", "Consultation")
|
||||
.WithOne("Visit")
|
||||
.HasForeignKey("LawFirmDatabaseImplement.Models.Visit", "ConsultationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Consultation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.VisitClient", b =>
|
||||
{
|
||||
b.HasOne("LawFirmDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("ClientVisits")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawFirmDatabaseImplement.Models.Visit", "Visit")
|
||||
.WithMany("Clients")
|
||||
.HasForeignKey("VisitId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("Visit");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Navigation("Clients");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("CaseClients");
|
||||
|
||||
b.Navigation("ClientVisits");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Company", b =>
|
||||
{
|
||||
b.Navigation("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Consultation", b =>
|
||||
{
|
||||
b.Navigation("Lawyers");
|
||||
|
||||
b.Navigation("Visit")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.Navigation("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Navigation("ConsultationLawyers");
|
||||
|
||||
b.Navigation("HearingLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Role", b =>
|
||||
{
|
||||
b.Navigation("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Visit", b =>
|
||||
{
|
||||
b.Navigation("Clients");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,181 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LawFirmDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddCompany : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "CompanyId",
|
||||
table: "Visits",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "CompanyId",
|
||||
table: "Users",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "CompanyId",
|
||||
table: "Lawyers",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "CompanyId",
|
||||
table: "Hearings",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "CompanyId",
|
||||
table: "Consultations",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "CompanyId",
|
||||
table: "Clients",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "CompanyId",
|
||||
table: "Cases",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Companies",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Companies", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Users_CompanyId",
|
||||
table: "Users",
|
||||
column: "CompanyId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Users_Companies_CompanyId",
|
||||
table: "Users",
|
||||
column: "CompanyId",
|
||||
principalTable: "Companies",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Users_Companies_CompanyId",
|
||||
table: "Users");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Companies");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Users_CompanyId",
|
||||
table: "Users");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "CompanyId",
|
||||
table: "Visits",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "CompanyId",
|
||||
table: "Users",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "CompanyId",
|
||||
table: "Lawyers",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "CompanyId",
|
||||
table: "Hearings",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "CompanyId",
|
||||
table: "Consultations",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "CompanyId",
|
||||
table: "Clients",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "CompanyId",
|
||||
table: "Cases",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
@ -30,8 +30,8 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CompanyId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
b.Property<int?>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
@ -82,8 +82,8 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CompanyId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
b.Property<int?>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
@ -102,6 +102,23 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Company", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Companies");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Consultation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -110,8 +127,8 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CompanyId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
b.Property<int?>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("float");
|
||||
@ -155,8 +172,8 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CompanyId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
b.Property<int?>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Court")
|
||||
.IsRequired()
|
||||
@ -207,8 +224,8 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CompanyId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
b.Property<int?>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
@ -256,8 +273,8 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CompanyId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
b.Property<int>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
@ -276,6 +293,8 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CompanyId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("Users");
|
||||
@ -289,8 +308,8 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CompanyId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
b.Property<int?>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ConsultationId")
|
||||
.HasColumnType("int");
|
||||
@ -399,12 +418,20 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.User", b =>
|
||||
{
|
||||
b.HasOne("LawFirmDatabaseImplement.Models.Company", "Company")
|
||||
.WithMany("Users")
|
||||
.HasForeignKey("CompanyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawFirmDatabaseImplement.Models.Role", "Role")
|
||||
.WithMany("Users")
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Company");
|
||||
|
||||
b.Navigation("Role");
|
||||
});
|
||||
|
||||
@ -452,6 +479,11 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
b.Navigation("ClientVisits");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Company", b =>
|
||||
{
|
||||
b.Navigation("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Consultation", b =>
|
||||
{
|
||||
b.Navigation("Lawyers");
|
||||
|
@ -15,7 +15,7 @@ namespace LawFirmDatabaseImplement.Models
|
||||
public class Case : ICaseModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string? CompanyId { get; set; }
|
||||
public int? CompanyId { get; set; }
|
||||
[Required]
|
||||
public string Name { get; private set; } = String.Empty;
|
||||
[Required]
|
||||
@ -81,7 +81,7 @@ namespace LawFirmDatabaseImplement.Models
|
||||
|
||||
|
||||
if (model.DateImplement.HasValue) DateImplement = model.DateImplement;
|
||||
if (!string.IsNullOrEmpty(model.CompanyId)) CompanyId = model.CompanyId;
|
||||
if (!model.CompanyId.HasValue) CompanyId = model.CompanyId;
|
||||
}
|
||||
public CaseViewModel GetViewModel => new()
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ namespace LawFirmDatabaseImplement.Models
|
||||
public class Client : IClientModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string? CompanyId { get; set; }
|
||||
public int? CompanyId { get; set; }
|
||||
[Required]
|
||||
public string FIO { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
@ -62,7 +62,7 @@ namespace LawFirmDatabaseImplement.Models
|
||||
FIO = model.FIO;
|
||||
Email = model.Email;
|
||||
Phone = model.Phone;
|
||||
if (!string.IsNullOrEmpty(model.CompanyId)) CompanyId = model.CompanyId;
|
||||
if (!model.CompanyId.HasValue) CompanyId = model.CompanyId;
|
||||
}
|
||||
public ClientViewModel GetViewModel => new()
|
||||
{
|
||||
|
58
LawFirm/LawFirmDatabaseImplement/Models/Company.cs
Normal file
58
LawFirm/LawFirmDatabaseImplement/Models/Company.cs
Normal file
@ -0,0 +1,58 @@
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using LawFirmContracts.BindingModels;
|
||||
using LawFirmContracts.ViewModels;
|
||||
using LawFirmDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LawFirmDatabaseImplement.Models
|
||||
{
|
||||
public class Company:ICompanyModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[ForeignKey("CompanyId")]
|
||||
public virtual List<User> Users { get; set; } = new();
|
||||
|
||||
public static Company? Create(LawFirmDatabase context, CompanyBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Company()
|
||||
{
|
||||
Id = model.Id,
|
||||
Name = model.Name,
|
||||
};
|
||||
}
|
||||
public static Company Create(CompanyViewModel model)
|
||||
{
|
||||
return new Company
|
||||
{
|
||||
Id = model.Id,
|
||||
Name = model.Name
|
||||
};
|
||||
}
|
||||
public void Update(CompanyBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Name = model.Name;
|
||||
}
|
||||
public CompanyViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name
|
||||
};
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ namespace LawFirmDatabaseImplement.Models
|
||||
public int Id { get; private set; }
|
||||
[Required]
|
||||
public double Cost { get; private set; }
|
||||
public string? CompanyId { get; set; }
|
||||
public int? CompanyId { get; set; }
|
||||
public Visit Visit { get; set; } = new(); //справочная навигация о зависимом классе
|
||||
private Dictionary<int, ILawyerModel>? _consultationLawyers = null;
|
||||
[NotMapped]
|
||||
@ -60,7 +60,7 @@ namespace LawFirmDatabaseImplement.Models
|
||||
return;
|
||||
}
|
||||
Cost = model.Cost;
|
||||
if (!string.IsNullOrEmpty(model.CompanyId)) CompanyId = model.CompanyId;
|
||||
if (!model.CompanyId.HasValue) CompanyId = model.CompanyId;
|
||||
}
|
||||
public ConsultationViewModel GetViewModel => new()
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ namespace LawFirmDatabaseImplement.Models
|
||||
[Required]
|
||||
public int CaseId { get; private set; }
|
||||
public virtual Case Case { get; private set; }
|
||||
public string? CompanyId { get; set; }
|
||||
public int? CompanyId { get; set; }
|
||||
[Required]
|
||||
public DateTime HearingDate { get; private set; }
|
||||
[Required]
|
||||
@ -72,7 +72,7 @@ namespace LawFirmDatabaseImplement.Models
|
||||
Court = model.Court;
|
||||
Judge = model.Judge;
|
||||
CaseId = model.CaseId;
|
||||
if (!string.IsNullOrEmpty(model.CompanyId)) CompanyId = model.CompanyId;
|
||||
if (!model.CompanyId.HasValue) CompanyId = model.CompanyId;
|
||||
}
|
||||
public HearingViewModel GetViewModel => new()
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ namespace LawFirmDatabaseImplement.Models
|
||||
public virtual List<ConsultationLawyer> ConsultationLawyers { get; set; } = new();
|
||||
[ForeignKey("LawyerId")]
|
||||
public virtual List<HearingLawyer> HearingLawyers { get; set; } = new();
|
||||
public string? CompanyId { get; set; }
|
||||
public int? CompanyId { get; set; }
|
||||
public static Lawyer? Create(LawFirmDatabase context, LawyerBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
@ -67,7 +67,7 @@ namespace LawFirmDatabaseImplement.Models
|
||||
Email = model.Email;
|
||||
Phone = model.Phone;
|
||||
Post = model.Post;
|
||||
if (!string.IsNullOrEmpty(model.CompanyId)) CompanyId = model.CompanyId;
|
||||
if (!model.CompanyId.HasValue) CompanyId = model.CompanyId;
|
||||
}
|
||||
public LawyerViewModel GetViewModel => new()
|
||||
{
|
||||
|
@ -16,7 +16,9 @@ namespace LawFirmDatabaseImplement.Models
|
||||
public class User : IUserModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string? CompanyId { get; set; }
|
||||
[Required]
|
||||
public int CompanyId { get; private set; }
|
||||
public virtual Company Company { get; set; }
|
||||
[Required]
|
||||
public int RoleId { get; set; }
|
||||
public Role Role { get; set; } = new();
|
||||
@ -65,7 +67,7 @@ namespace LawFirmDatabaseImplement.Models
|
||||
FIO = model.FIO;
|
||||
Email = model.Email;
|
||||
Password = model.Password;
|
||||
if (!string.IsNullOrEmpty(model.CompanyId)) CompanyId = model.CompanyId;
|
||||
CompanyId = model.CompanyId;
|
||||
}
|
||||
public UserViewModel GetViewModel => new()
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ namespace LawFirmDatabaseImplement.Models
|
||||
public int ConsultationId { get; private set; }
|
||||
public Consultation Consultation { get; set; } = null!;
|
||||
//---
|
||||
public string? CompanyId { get; set; }
|
||||
public int? CompanyId { get; set; }
|
||||
|
||||
private Dictionary<int, IClientModel>? _visitClients = null;
|
||||
[NotMapped]
|
||||
@ -76,7 +76,7 @@ namespace LawFirmDatabaseImplement.Models
|
||||
{
|
||||
Client = context.Clients.First(y => y.Id == x.Key)
|
||||
}).ToList();
|
||||
if (!string.IsNullOrEmpty(model.CompanyId)) CompanyId = model.CompanyId;
|
||||
if (!model.CompanyId.HasValue) CompanyId = model.CompanyId;
|
||||
}
|
||||
public VisitViewModel GetViewModel => new()
|
||||
{
|
||||
|
45
LawFirm/LawFirmManagerApp/APIClient.cs
Normal file
45
LawFirm/LawFirmManagerApp/APIClient.cs
Normal file
@ -0,0 +1,45 @@
|
||||
using LawFirmContracts.ViewModels;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
|
||||
namespace LawFirmManagerApp
|
||||
{
|
||||
public class APIClient
|
||||
{
|
||||
private static readonly HttpClient _client = new();
|
||||
public static UserViewModel? User { get; set; } = null;
|
||||
public static void Connect(IConfiguration configuration)
|
||||
{
|
||||
_client.BaseAddress = new Uri(configuration["IPAddress"]);
|
||||
_client.DefaultRequestHeaders.Accept.Clear();
|
||||
_client.DefaultRequestHeaders.Accept.Add(new
|
||||
MediaTypeWithQualityHeaderValue("application/json"));
|
||||
}
|
||||
public static T? GetRequest<T>(string requestUrl)
|
||||
{
|
||||
var response = _client.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 = _client.PostAsync(requestUrl, data);
|
||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||
if (!response.Result.IsSuccessStatusCode)
|
||||
{
|
||||
throw new Exception(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
using LawFirmContracts.BindingModels;
|
||||
using LawFirmContracts.SearchModels;
|
||||
using LawFirmContracts.ViewModels;
|
||||
using LawFirmManagerApp;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace LawFirmClientApp.Controllers
|
@ -1,6 +1,7 @@
|
||||
using LawFirmContracts.BindingModels;
|
||||
using LawFirmContracts.SearchModels;
|
||||
using LawFirmContracts.ViewModels;
|
||||
using LawFirmManagerApp;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace LawFirmClientApp.Controllers
|
166
LawFirm/LawFirmManagerApp/Controllers/HomeController.cs
Normal file
166
LawFirm/LawFirmManagerApp/Controllers/HomeController.cs
Normal file
@ -0,0 +1,166 @@
|
||||
using LawFirmManagerApp.Models;
|
||||
using LawFirmContracts.BindingModels;
|
||||
using LawFirmContracts.ViewModels;
|
||||
using LawFirmManagerApp;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics;
|
||||
using LawFirmContracts.SearchModels;
|
||||
|
||||
namespace LawFirmClientApp.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
|
||||
public HomeController(ILogger<HomeController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
// СТРАНИЦЫ КОНСУЛЬТАЦИЙ
|
||||
|
||||
public IActionResult Consultations()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/EnterManager");
|
||||
}
|
||||
return
|
||||
View(APIClient.GetRequest<List<ConsultationViewModel>>($"api/consultation/getconsultationlist?companyid={APIClient.User.CompanyId}"));
|
||||
}
|
||||
|
||||
// СТРАНИЦА СЛУШАНИЙ
|
||||
|
||||
public IActionResult Hearings()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/EnterManager");
|
||||
}
|
||||
return
|
||||
View(APIClient.GetRequest<List<HearingViewModel>>($"api/hearing/gethearinglist?companyid={APIClient.User.CompanyId}"));
|
||||
}
|
||||
|
||||
// СТРАНИЦА ЮРИСТОВ
|
||||
public IActionResult Lawyers()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/EnterManager");
|
||||
}
|
||||
return
|
||||
View(APIClient.GetRequest<List<LawyerViewModel>>($"api/lawyer/getlawyerlist?companyid={APIClient.User.CompanyId}"));
|
||||
}
|
||||
|
||||
// ЛИЧНЫЕ ДАННЫЕ ПОРУЧИТЕЛЯ
|
||||
[HttpGet]
|
||||
public IActionResult PrivacyManager()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/EnterManager");
|
||||
}
|
||||
ViewBag.Companies = APIClient.GetRequest<List<CompanyViewModel>>($"api/company/getcompanylist");
|
||||
return View(APIClient.User);
|
||||
}
|
||||
[HttpPost]
|
||||
public void PrivacyManager(string login, string password, string fio, int companyid)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
if (string.IsNullOrEmpty(login) ||
|
||||
string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
|
||||
{
|
||||
throw new Exception("Введите логин, пароль и ФИО");
|
||||
}
|
||||
APIClient.PostRequest("api/usermanager/updatedata", new
|
||||
UserBindingModel
|
||||
{
|
||||
Id = APIClient.User.Id,
|
||||
FIO = fio,
|
||||
Email = login,
|
||||
Password = password,
|
||||
CompanyId = companyid
|
||||
|
||||
});
|
||||
APIClient.User.FIO = fio;
|
||||
APIClient.User.Email = login;
|
||||
APIClient.User.Password = password;
|
||||
APIClient.User.CompanyId = companyid;
|
||||
Response.Redirect("Lawyers");
|
||||
}
|
||||
|
||||
// РЕГИСТРАЦИЯ ПОРУЧИТЕЛЯ
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult RegisterManager()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void RegisterManager(string login, string password, string fio, string company)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) ||
|
||||
string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio) || string.IsNullOrEmpty(company))
|
||||
{
|
||||
throw new Exception("Введите логин, пароль, ФИО и компанию");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/company/createcompany", new
|
||||
CompanyBindingModel
|
||||
{
|
||||
Name = company,
|
||||
});
|
||||
|
||||
APIClient.PostRequest("api/usermanager/register", new
|
||||
UserBindingModel
|
||||
{
|
||||
RoleId = 2,
|
||||
FIO = fio,
|
||||
Email = login,
|
||||
Password = password,
|
||||
CompanyId = APIClient.GetRequest<int>($"api/company/getcompanyid?companyname={company}")
|
||||
|
||||
}) ;
|
||||
Response.Redirect("EnterManager");
|
||||
return;
|
||||
}
|
||||
|
||||
// ВХОД ДЛЯ ПОРУЧИТЕЛЯ
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult EnterManager()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void EnterManager(string login, string password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) ||
|
||||
string.IsNullOrEmpty(password))
|
||||
{
|
||||
throw new Exception("Введите логин и пароль");
|
||||
}
|
||||
APIClient.User = APIClient.GetRequest<UserViewModel>($"api/usermanager/login?login={login}&password={password}");
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
|
||||
Response.Redirect("EnterManager");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (APIClient.User.RoleId == 2) { Response.Redirect("/Home/Lawyers"); }
|
||||
else throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using LawFirmContracts.BindingModels;
|
||||
using LawFirmContracts.SearchModels;
|
||||
using LawFirmManagerApp;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace LawFirmClientApp.Controllers
|
42
LawFirm/LawFirmManagerApp/Controllers/ReportController.cs
Normal file
42
LawFirm/LawFirmManagerApp/Controllers/ReportController.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using LawFirmContracts.BindingModels;
|
||||
using LawFirmContracts.ViewModels;
|
||||
using LawFirmManagerApp;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace LawFirmClientApp.Controllers
|
||||
{
|
||||
public class ReportController : Controller
|
||||
{
|
||||
|
||||
/*[HttpGet]
|
||||
public void CreateReportClients(DateTime dateFrom, DateTime dateTo)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
|
||||
APIClient.GetRequest<List<ReportClientsViewModel>>($"api/report/getclientsreport", new ReportBindingModel
|
||||
{
|
||||
DateFrom = dateFrom,
|
||||
DateTo = dateTo
|
||||
|
||||
|
||||
|
||||
Response.Redirect("CreateReportClients");
|
||||
}*/
|
||||
[HttpGet]
|
||||
|
||||
public IActionResult CreateReportClients(DateTime dateFrom, DateTime dateTo)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
return View(APIClient.GetRequest<List<ReportClientsViewModel>>($"api/report/getclientsreport?datefrom={dateFrom}&dateTo={dateTo}&companyId={APIClient.User.CompanyId}"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
14
LawFirm/LawFirmManagerApp/LawFirmManagerApp.csproj
Normal file
14
LawFirm/LawFirmManagerApp/LawFirmManagerApp.csproj
Normal file
@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LawFirmContracts\LawFirmContracts.csproj" />
|
||||
<ProjectReference Include="..\LawFirmDatabaseImplement\LawFirmDatabaseImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
9
LawFirm/LawFirmManagerApp/Models/ErrorViewModel.cs
Normal file
9
LawFirm/LawFirmManagerApp/Models/ErrorViewModel.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace LawFirmManagerApp.Models
|
||||
{
|
||||
public class ErrorViewModel
|
||||
{
|
||||
public string? RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
}
|
||||
}
|
35
LawFirm/LawFirmManagerApp/Program.cs
Normal file
35
LawFirm/LawFirmManagerApp/Program.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using LawFirmContracts.StoragesContracts;
|
||||
using LawFirmDatabaseImplement.Implements;
|
||||
using LawFirmManagerApp;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddTransient<ICaseStorage, CaseStorage>();
|
||||
builder.Services.AddTransient<IVisitStorage, VisitStorage>();
|
||||
builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
||||
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllersWithViews();
|
||||
|
||||
var app = builder.Build();
|
||||
APIClient.Connect(builder.Configuration);
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=EnterManager}/{id?}");
|
||||
|
||||
app.Run();
|
28
LawFirm/LawFirmManagerApp/Properties/launchSettings.json
Normal file
28
LawFirm/LawFirmManagerApp/Properties/launchSettings.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:22711",
|
||||
"sslPort": 44324
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"LawFirmManagerApp": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:7221;http://localhost:5236",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -30,11 +30,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Код компании:</div>
|
||||
<div class="col-4">Компания:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="fio"
|
||||
value=@Html.DisplayFor(modelitem => Model.CompanyId) />
|
||||
<input type="text" name="company"
|
||||
value=@Html.DisplayFor(modelitem => Model.CompanyName) />
|
||||
<div>Изменить компанию:</div>
|
||||
<select id="companyid" name="companyid" class="form-control col-4" style="width: 30%;" asp-items="@(new SelectList(@ViewBag.Companies, "Id", "Name"))"></select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
@ -18,6 +18,10 @@
|
||||
<div class="col-4">ФИО:</div>
|
||||
<div class="col-8"><input type="text" name="fio" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Название компании:</div>
|
||||
<div class="col-8"><input type="text" name="company" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
25
LawFirm/LawFirmManagerApp/Views/Shared/Error.cshtml
Normal file
25
LawFirm/LawFirmManagerApp/Views/Shared/Error.cshtml
Normal file
@ -0,0 +1,25 @@
|
||||
@model ErrorViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
@ -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="StartView">LawFirmClientApp</a>
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Lawyers">LawFirmManagertApp</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>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user