Промежутный коммит, исправлены баги

This commit is contained in:
maxnes3 2023-05-19 14:39:49 +04:00
parent 4bea770d99
commit f03bb241c0
14 changed files with 88 additions and 67 deletions

View File

@ -79,5 +79,16 @@ namespace CaseAccountingCustomerView.Controllers
SpecializationViewModel? specialization = APIUser.GetRequest<SpecializationViewModel>($"api/specialization/get?id={id}");
return specialization;
}
}
public List<SpecializationViewModel> GetAll()
{
if (APIUser.User == null)
{
return new();
}
List<SpecializationViewModel>? specializations = APIUser.GetRequest<List<SpecializationViewModel>>($"api/specialization/getall");
return specializations ?? new();
}
}
}

View File

@ -18,8 +18,8 @@ namespace CaseAccountingDataBaseImplement
Host=localhost;
Port=5432;
Database=CaseAccountingDatabase;
Username=postgres;
Password=postgres");
Username=courseuser;
Password=courseuser");
}
base.OnConfiguring(optionsBuilder);
}

View File

@ -139,6 +139,7 @@ namespace CaseAccountingDataBaseImplement.Models
Annotation = Annotation,
Date = Date,
SpecializationId = SpecializationId,
Specialization = Specialization.Name,
UserId = UserId
};
}

View File

@ -119,5 +119,15 @@ namespace CaseAccountingProviderView.Controllers
CaseViewModel? caseModel = APIUser.GetRequest<CaseViewModel>($"api/case/get?id={id}");
return caseModel;
}
public List<SpecializationViewModel> GetAllSpecializations()
{
if (APIUser.User == null)
{
return new();
}
List<SpecializationViewModel>? specializationModel = APIUser.GetRequest<List<SpecializationViewModel>>($"api/case/getallspecializations");
return specializationModel ?? new();
}
}
}

View File

@ -22,7 +22,6 @@
<input type="text" id="annotation-input" name="annotation" class="form-control mb-3" />
<p class="mb-0">Специализация:</p>
<select id="specialization-select" name="specialization" class="form-control mb-3">
<option></option>
</select>
<button id="create-button" type="button" class="btn btn-primary text-button">

View File

@ -30,7 +30,6 @@
<input type="text" id="annotation-input" name="annotation" class="form-control mb-3" />
<p class="mb-0">Специализация:</p>
<select id="specialization-select" name="specialization" class="form-control mb-3">
<option></option>
</select>
<button id="update-button" type="button" class="btn btn-primary text-button">

View File

@ -16,7 +16,6 @@
<input type="date" id="date-input" name="date" class="form-control mb-3" />
<p class="mb-0">Дело:</p>
<select id="case-select" name="case" class="form-control mb-3">
<option></option>
</select>
<button id="create-button" type="button" class="btn btn-primary text-button">

View File

@ -24,7 +24,6 @@
<input type="date" id="date-input" name="date" class="form-control mb-3" />
<p class="mb-0">Дело:</p>
<select id="case-select" name="case" class="form-control mb-3">
<option></option>
</select>
<button id="update-button" type="button" class="btn btn-primary text-button">

View File

@ -10,19 +10,19 @@ var specializations = [];
window.addEventListener("load", async () => {
try {
const specializationsResponse = await $.ajax({
url: `/specialization/getall`,
await $.ajax({
url: `/case/getallspecializations`,
type: "GET",
contentType: "json"
});
specializations = specializationsResponse;
specializations.forEach((specialization) => {
const option = document.createElement("option");
option.value = specialization.id;
option.innerHTML = specialization.name;
specializationSelect.appendChild(option);
specializationSelect.selectedIndex = -1;
}).done((result) => {
specializations = result;
specializations.forEach((specialization) => {
const option = document.createElement("option");
option.value = specialization.id;
option.innerHTML = specialization.name;
specializationSelect.appendChild(option);
specializationSelect.selectedIndex = -1;
});
});
} catch (error) {
console.error(error);

View File

@ -11,19 +11,19 @@ var specializations = [];
window.addEventListener("load", async () => {
try {
const specializationsResponse = await $.ajax({
url: `/specialization/getall`,
await $.ajax({
url: `/case/getallspecializations`,
type: "GET",
contentType: "json"
});
specializations = specializationsResponse;
specializations.forEach((specialization) => {
const option = document.createElement("option");
option.value = specialization.id;
option.innerHTML = specialization.name;
specializationSelect.appendChild(option);
specializationSelect.selectedIndex = -1;
}).done((result) => {
specializations = result;
specializations.forEach((specialization) => {
const option = document.createElement("option");
option.value = specialization.id;
option.innerHTML = specialization.name;
specializationSelect.appendChild(option);
specializationSelect.selectedIndex = -1;
});
});
} catch (error) {
console.error(error);

View File

@ -7,19 +7,19 @@ var cases = [];
window.addEventListener("load", async () => {
try {
const casesResponse = await $.ajax({
url: `/specialization/getall`,
$.ajax({
url: "/case/getallbyuser",
type: "GET",
contentType: "json"
});
cases = casesResponse;
cases.forEach((element) => {
const option = document.createElement("option");
option.value = element.id;
option.innerHTML = "Дело №" + element.id;
caseSelect.appendChild(option);
caseSelect.selectedIndex = -1;
}).done((result) => {
cases = result;
cases.forEach((element) => {
const option = document.createElement("option");
option.value = element.id;
option.innerHTML = "Дело №" + element.id;
caseSelect.appendChild(option);
caseSelect.selectedIndex = -1;
});
});
} catch (error) {
console.error(error);
@ -51,7 +51,7 @@ createBtn.addEventListener("click", () => {
"CaseId": parseInt(caseSelect.value),
"Date": new Date(dateInput.value)
};
console.log(dealModel)
console.log(hearingModel)
$.ajax({
url: "/hearing/create",
type: "POST",

View File

@ -8,19 +8,19 @@ var cases = [];
window.addEventListener("load", async () => {
try {
const casesResponse = await $.ajax({
url: `/specialization/getall`,
$.ajax({
url: "/case/getallbyuser",
type: "GET",
contentType: "json"
});
cases = casesResponse;
cases.forEach((element) => {
const option = document.createElement("option");
option.value = element.id;
option.innerHTML = "Дело №" + element.id;
caseSelect.appendChild(option);
caseSelect.selectedIndex = -1;
}).done((result) => {
cases = result;
cases.forEach((element) => {
const option = document.createElement("option");
option.value = element.id;
option.innerHTML = "Дело №" + element.id;
caseSelect.appendChild(option);
caseSelect.selectedIndex = -1;
});
});
} catch (error) {
console.error(error);

View File

@ -1,4 +1,5 @@
using CaseAccountingContracts.BindingModels;
using CaseAccountingBusinessLogic.BusinessLogics;
using CaseAccountingContracts.BindingModels;
using CaseAccountingContracts.BusinessLogicContracts;
using CaseAccountingContracts.SearchModels;
using CaseAccountingContracts.ViewModels;
@ -11,10 +12,12 @@ namespace CaseAccountingRestApi.Controllers
public class CaseController : Controller
{
private readonly ICaseLogic _logic;
private readonly ISpecializationLogic _specializationLogic;
public CaseController(ICaseLogic logic)
public CaseController(ICaseLogic logic, ISpecializationLogic specializationLogic)
{
_logic = logic;
_specializationLogic = specializationLogic;
}
[HttpGet]
@ -43,6 +46,19 @@ namespace CaseAccountingRestApi.Controllers
}
}
[HttpGet]
public List<SpecializationViewModel>? GetAllSpecializations()
{
try
{
return _specializationLogic.ReadList(null);
}
catch (Exception)
{
throw;
}
}
[HttpPost]
public void Create(CaseBindingModel model)
{

View File

@ -44,19 +44,6 @@ namespace CaseAccountingRestApi.Controllers
}
}
[HttpGet]
public List<SpecializationViewModel>? GetAll()
{
try
{
return specializationLogic.ReadList(null);
}
catch (Exception)
{
throw;
}
}
[HttpPost]
public void Create(SpecializationBindingModel model)