Чиним многие-ко-многим

This commit is contained in:
Артём Алейкин 2023-05-19 18:12:37 +04:00
parent 79071f22b2
commit 1843a431ec
5 changed files with 11 additions and 15 deletions

View File

@ -1,7 +1,9 @@
using CaseAccountingDataModels.Models; using CaseAccountingContracts.ViewModels;
using CaseAccountingDataModels.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -24,5 +26,9 @@ namespace CaseAccountingContracts.BindingModels
public int Id { get; set; } public int Id { get; set; }
public Dictionary<int, IContractModel> Contracts { get; set; } = new(); public Dictionary<int, IContractModel> Contracts { get; set; } = new();
public List<ContractViewModel> ContractViewModels { get; set; } = new();
} }
} }

View File

@ -71,16 +71,6 @@ namespace CaseAccountingCustomerView.Controllers
return lawyers ?? new(); return lawyers ?? new();
} }
/*public List<EducationGroupViewModel> GetAllCases()
{
if (APIUser.User == null)
{
return new();
}
List<EducationGroupViewModel>? group = APIUser.GetRequest<List<EducationGroupViewModel>>("api/lawyer/GetAllCases");
return group ?? new();
}*/
public LawyerViewModel? Get(int id) public LawyerViewModel? Get(int id)
{ {
if (APIUser.User == null) if (APIUser.User == null)

View File

@ -16,7 +16,7 @@ window.addEventListener('load', async () => {
console.log(cases) console.log(cases)
}); });
await $.ajax({ await $.ajax({
url: `/document/get?id=${currentLawyerId}`, url: `/lawyer/get?id=${currentLawyerId}`,
type: "GET", type: "GET",
contentType: "json" contentType: "json"
}).done((result) => { }).done((result) => {
@ -33,7 +33,7 @@ createBtn.addEventListener('click', () => {
"Surname": currentLawyer.Surname, "Surname": currentLawyer.Surname,
"Patronymic": currentLawyer.Patronymic, "Patronymic": currentLawyer.Patronymic,
"SpecializationId": currentLawyer.SpecializationId, "SpecializationId": currentLawyer.SpecializationId,
"LawyerContracts": currentLawyer.lawyerContracts, "ContractViewModels": currentLawyer.lawyerContracts,
"LawyerCases": dataArray, "LawyerCases": dataArray,
} }
$.ajax({ $.ajax({

View File

@ -25,7 +25,7 @@ createBtn.addEventListener('click', () => {
"Surname": surnameInput.value, "Surname": surnameInput.value,
"Patronymic": patronymicInput.value, "Patronymic": patronymicInput.value,
"Experience": parseInt(experienceInput.value), "Experience": parseInt(experienceInput.value),
"LawyerContracts": dataArray, "ContractViewModels": dataArray,
} }
console.log(lawyer); console.log(lawyer);
$.ajax({ $.ajax({

View File

@ -31,7 +31,7 @@ createBtn.addEventListener('click', () => {
"Service": serviceInput.value, "Service": serviceInput.value,
"Coast": coastInput.value, "Coast": coastInput.value,
"Date": currentLawyer.date, "Date": currentLawyer.date,
"LawyerContracts": dataArray, "ContractViewModels": dataArray,
"LawyerCases": currentLawyer.lawyerCases, "LawyerCases": currentLawyer.lawyerCases,
} }
$.ajax({ $.ajax({