работа над приложением, датами слушаний и консультаций
This commit is contained in:
parent
ea7cf43cf9
commit
ed15c81c92
@ -5,6 +5,8 @@
|
||||
public int? Id { get; set; }
|
||||
public double? Cost { get; set; }
|
||||
public DateTime? ConsultationDate { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
public int? CaseId { get; set; }
|
||||
public int? GuarantorId { get; set; }
|
||||
}
|
||||
|
@ -4,6 +4,8 @@
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public DateTime? HearingDate { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
public int? GuarantorId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,6 @@ namespace LawCompanyContracts.ViewModels
|
||||
[DisplayName("Дело")]
|
||||
public string CaseName { get; set; } = string.Empty;
|
||||
public int CaseId { get; set; }
|
||||
[DisplayName("Имя поручителя")]
|
||||
public string GuarantorName { get; set; } = string.Empty;
|
||||
public int GuarantorId { get; set; }
|
||||
public Dictionary<int, ILawyerModel> ConsultationLawyers { get; set; } = new();
|
||||
}
|
||||
|
@ -11,8 +11,6 @@ namespace LawCompanyContracts.ViewModels
|
||||
public DateTime HearingDate { get; set; }
|
||||
[DisplayName("Суд")]
|
||||
public string Judge { get; set; } = string.Empty;
|
||||
[DisplayName("Имя поручителя")]
|
||||
public string GuarantorName { get; set; } = string.Empty;
|
||||
public int GuarantorId { get; set; }
|
||||
public Dictionary<int, ILawyerModel> HearingLawyers { get; set; } = new();
|
||||
}
|
@ -21,10 +21,23 @@ namespace LawCompanyDatabaseImplement.Implements
|
||||
}
|
||||
public List<ConsultationViewModel> GetFilteredList(ConsultationSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue && !model.GuarantorId.HasValue)
|
||||
if (!model.Id.HasValue && !model.GuarantorId.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue
|
||||
&& !model.ConsultationDate.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
if (!model.GuarantorId.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
return context.Consultations
|
||||
.Include(x => x.Lawyers)
|
||||
.ThenInclude(x => x.Lawyer)
|
||||
.Where(x => x.GuarantorId == model.GuarantorId && x.ConsultationDate >= model.DateFrom
|
||||
&& x.ConsultationDate <= model.DateTo)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
if (!model.GuarantorId.HasValue)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
@ -32,6 +45,18 @@ namespace LawCompanyDatabaseImplement.Implements
|
||||
.Include(x => x.Lawyers)
|
||||
.ThenInclude(x => x.Lawyer)
|
||||
.Where(x => x.GuarantorId == model.GuarantorId)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
return context.Consultations
|
||||
.Include(x => x.Lawyers)
|
||||
.ThenInclude(x => x.Lawyer)
|
||||
.Where(x => x.Id == model.Id)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -41,14 +66,15 @@ namespace LawCompanyDatabaseImplement.Implements
|
||||
return context.Consultations
|
||||
.Include(x => x.Lawyers)
|
||||
.ThenInclude(x => x.Lawyer)
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Where(x => x.ConsultationDate >= model.DateFrom && x.ConsultationDate <= model.DateTo)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
public ConsultationViewModel? GetElement(ConsultationSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue && !model.GuarantorId.HasValue)
|
||||
if (!model.Id.HasValue && !model.GuarantorId.HasValue && !model.ConsultationDate.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -21,11 +21,22 @@ namespace LawCompanyDatabaseImplement.Implements
|
||||
}
|
||||
public List<HearingViewModel> GetFilteredList(HearingSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue && !model.GuarantorId.HasValue)
|
||||
if (!model.Id.HasValue && !model.GuarantorId.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue
|
||||
&& !model.HearingDate.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
if (!model.GuarantorId.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
return context.Hearings
|
||||
.Include(x => x.Lawyers)
|
||||
.ThenInclude(x => x.Lawyer)
|
||||
.Where(x => x.GuarantorId == model.GuarantorId && x.HearingDate >= model.DateFrom
|
||||
&& x.HearingDate <= model.DateTo)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
if (!model.GuarantorId.HasValue)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
@ -36,7 +47,7 @@ namespace LawCompanyDatabaseImplement.Implements
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
else if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
return context.Hearings
|
||||
@ -46,10 +57,20 @@ namespace LawCompanyDatabaseImplement.Implements
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
return context.Hearings
|
||||
.Include(x => x.Lawyers)
|
||||
.ThenInclude(x => x.Lawyer)
|
||||
.Where(x => x.HearingDate >= model.DateFrom && x.HearingDate <= model.DateTo)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
public HearingViewModel? GetElement(HearingSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue && !model.GuarantorId.HasValue)
|
||||
if (!model.Id.HasValue && !model.GuarantorId.HasValue && !model.HearingDate.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@ -60,7 +81,6 @@ namespace LawCompanyDatabaseImplement.Implements
|
||||
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id || (model.GuarantorId.HasValue
|
||||
&& x.GuarantorId == model.GuarantorId))
|
||||
?.GetViewModel;
|
||||
|
||||
}
|
||||
public HearingViewModel? Insert(HearingBindingModel model)
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ namespace LawCompanyDatabaseImplement
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseSqlServer(@"Data Source=LAPTOP-6GNIALH9\SQLEXPRESS;Initial Catalog=LawCompanyDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-H8060U3\SQLEXPRESS;Initial Catalog=LawCompanyDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
6
LawCompany/LawCompanyGuarantorApp/APIClient.cs
Normal file
6
LawCompany/LawCompanyGuarantorApp/APIClient.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace LawCompanyGuarantorApp
|
||||
{
|
||||
public class APIClient
|
||||
{
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddControllersWithViews();
|
||||
|
||||
var app = builder.Build();
|
||||
APIClient.Connect(builder.Configuration);
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
@ -22,6 +23,6 @@ app.UseAuthorization();
|
||||
|
||||
app.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
pattern: "{controller=Home}/{action=EnterGuarantor}/{id?}");
|
||||
|
||||
app.Run();
|
||||
|
@ -0,0 +1,5 @@
|
||||
@*
|
||||
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
*@
|
||||
@{
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
@*
|
||||
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
*@
|
||||
@{
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
@*
|
||||
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
*@
|
||||
@{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Welcome</h1>
|
||||
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
||||
</div>
|
@ -0,0 +1,5 @@
|
||||
@*
|
||||
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
*@
|
||||
@{
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
@{
|
||||
ViewData["Title"] = "Privacy Policy";
|
||||
}
|
||||
<h1>@ViewData["Title"]</h1>
|
||||
|
||||
<p>Use this page to detail your site's privacy policy.</p>
|
@ -0,0 +1,5 @@
|
||||
@*
|
||||
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
*@
|
||||
@{
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
@*
|
||||
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
*@
|
||||
@{
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
@{
|
||||
Layout = "_Layout";
|
||||
Layout = "_LayoutGuarantor";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user