Compare commits

..

2 Commits

5 changed files with 23 additions and 5 deletions

View File

@ -6,6 +6,10 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LawFimDataModels\LawFimDataModels.csproj" />
</ItemGroup>

View File

@ -1,6 +1,7 @@
using LawFimDataModels.Enums;
using LawFimDataModels.Models;
using System.ComponentModel;
using Newtonsoft.Json;
namespace LawFirmContracts.ViewModels
{
@ -19,5 +20,11 @@ namespace LawFirmContracts.ViewModels
public DateTime? DateImplement { get; set; }
public Dictionary<int, IClientModel> CaseClients { get; set; } = new();
public int ExecutorId { get; set; }
}
public CaseViewModel() { }
[JsonConstructor]
public CaseViewModel(Dictionary<int, ClientViewModel> CaseClients)
{
this.CaseClients = CaseClients.ToDictionary(x => x.Key, x => x.Value as IClientModel);
}
}
}

View File

@ -1,5 +1,6 @@
using LawFimDataModels.Models;
using System.ComponentModel;
using Newtonsoft.Json;
namespace LawFirmContracts.ViewModels
{
@ -11,5 +12,11 @@ namespace LawFirmContracts.ViewModels
public int HearingId { get; set; }
public Dictionary<int, IClientModel> VisitClients { get; set; } = new();
public int ExecutorId { get; set; }
}
public VisitViewModel() { }
[JsonConstructor]
public VisitViewModel(Dictionary<int, ClientViewModel> VisitClients)
{
this.VisitClients = VisitClients.ToDictionary(x => x.Key, x => x.Value as IClientModel);
}
}
}

View File

@ -31,14 +31,14 @@ namespace LawFirmExecutorApp.Controllers
return View();
}
[HttpPost]
public void AddClient(int conId, int clientId)
public void AddClient(int caseId, int clientId)
{
if (APIClient.Executor == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
APIClient.PostRequest("api/case/addclienttocase", Tuple.Create(new CaseSearchModel { Id = conId }, clientId));
APIClient.PostRequest("api/case/addclienttocase", Tuple.Create(new CaseSearchModel { Id = caseId }, clientId));
Response.Redirect("/Home/Cases");
}
[HttpGet]

View File

@ -12,7 +12,7 @@
<div class="row">
<div class="col-4">Дело</div>
<div class="col-8">
<select id="id" name="id" class="form-control" asp-items="@(new SelectList(@ViewBag.Cases,"Id", "Name"))"></select>
<select id="caseId" name="caseId" class="form-control" asp-items="@(new SelectList(@ViewBag.Cases,"Id", "Name"))"></select>
</div>
</div>
<div class="row">