работа над приложением, датами слушаний и консультаций
This commit is contained in:
parent
ea7cf43cf9
commit
ed15c81c92
@ -5,7 +5,9 @@
|
|||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public double? Cost { get; set; }
|
public double? Cost { get; set; }
|
||||||
public DateTime? ConsultationDate { get; set; }
|
public DateTime? ConsultationDate { get; set; }
|
||||||
public int? CaseId { get; set; }
|
public DateTime? DateFrom { get; set; }
|
||||||
public int? GuarantorId { 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 int? Id { get; set; }
|
||||||
public DateTime? HearingDate { get; set; }
|
public DateTime? HearingDate { get; set; }
|
||||||
public int? GuarantorId { 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("Дело")]
|
[DisplayName("Дело")]
|
||||||
public string CaseName { get; set; } = string.Empty;
|
public string CaseName { get; set; } = string.Empty;
|
||||||
public int CaseId { get; set; }
|
public int CaseId { get; set; }
|
||||||
[DisplayName("Имя поручителя")]
|
|
||||||
public string GuarantorName { get; set; } = string.Empty;
|
|
||||||
public int GuarantorId { get; set; }
|
public int GuarantorId { get; set; }
|
||||||
public Dictionary<int, ILawyerModel> ConsultationLawyers { get; set; } = new();
|
public Dictionary<int, ILawyerModel> ConsultationLawyers { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,6 @@ namespace LawCompanyContracts.ViewModels
|
|||||||
public DateTime HearingDate { get; set; }
|
public DateTime HearingDate { get; set; }
|
||||||
[DisplayName("Суд")]
|
[DisplayName("Суд")]
|
||||||
public string Judge { get; set; } = string.Empty;
|
public string Judge { get; set; } = string.Empty;
|
||||||
[DisplayName("Имя поручителя")]
|
|
||||||
public string GuarantorName { get; set; } = string.Empty;
|
|
||||||
public int GuarantorId { get; set; }
|
public int GuarantorId { get; set; }
|
||||||
public Dictionary<int, ILawyerModel> HearingLawyers { get; set; } = new();
|
public Dictionary<int, ILawyerModel> HearingLawyers { get; set; } = new();
|
||||||
}
|
}
|
@ -21,10 +21,23 @@ namespace LawCompanyDatabaseImplement.Implements
|
|||||||
}
|
}
|
||||||
public List<ConsultationViewModel> GetFilteredList(ConsultationSearchModel model)
|
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();
|
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)
|
if (!model.GuarantorId.HasValue)
|
||||||
{
|
{
|
||||||
using var context = new LawCompanyDatabase();
|
using var context = new LawCompanyDatabase();
|
||||||
@ -32,23 +45,36 @@ namespace LawCompanyDatabaseImplement.Implements
|
|||||||
.Include(x => x.Lawyers)
|
.Include(x => x.Lawyers)
|
||||||
.ThenInclude(x => x.Lawyer)
|
.ThenInclude(x => x.Lawyer)
|
||||||
.Where(x => x.GuarantorId == model.GuarantorId)
|
.Where(x => x.GuarantorId == model.GuarantorId)
|
||||||
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.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();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
using var context = new LawCompanyDatabase();
|
using var context = new LawCompanyDatabase();
|
||||||
return context.Consultations
|
return context.Consultations
|
||||||
.Include(x => x.Lawyers)
|
.Include(x => x.Lawyers)
|
||||||
.ThenInclude(x => x.Lawyer)
|
.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)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public ConsultationViewModel? GetElement(ConsultationSearchModel model)
|
public ConsultationViewModel? GetElement(ConsultationSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue && !model.GuarantorId.HasValue)
|
if (!model.Id.HasValue && !model.GuarantorId.HasValue && !model.ConsultationDate.HasValue)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -21,11 +21,22 @@ namespace LawCompanyDatabaseImplement.Implements
|
|||||||
}
|
}
|
||||||
public List<HearingViewModel> GetFilteredList(HearingSearchModel model)
|
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();
|
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)
|
if (!model.GuarantorId.HasValue)
|
||||||
{
|
{
|
||||||
using var context = new LawCompanyDatabase();
|
using var context = new LawCompanyDatabase();
|
||||||
@ -36,20 +47,30 @@ namespace LawCompanyDatabaseImplement.Implements
|
|||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
else if (!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.Id == model.Id)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
using var context = new LawCompanyDatabase();
|
using var context = new LawCompanyDatabase();
|
||||||
return context.Hearings
|
return context.Hearings
|
||||||
.Include(x => x.Lawyers)
|
.Include(x => x.Lawyers)
|
||||||
.ThenInclude(x => x.Lawyer)
|
.ThenInclude(x => x.Lawyer)
|
||||||
.Where(x => x.Id == model.Id)
|
.Where(x => x.HearingDate >= model.DateFrom && x.HearingDate <= model.DateTo)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public HearingViewModel? GetElement(HearingSearchModel model)
|
public HearingViewModel? GetElement(HearingSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue && !model.GuarantorId.HasValue)
|
if (!model.Id.HasValue && !model.GuarantorId.HasValue && !model.HearingDate.HasValue)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -58,9 +79,8 @@ namespace LawCompanyDatabaseImplement.Implements
|
|||||||
.Include(x => x.Lawyers)
|
.Include(x => x.Lawyers)
|
||||||
.ThenInclude(x => x.Lawyer)
|
.ThenInclude(x => x.Lawyer)
|
||||||
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id || (model.GuarantorId.HasValue
|
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id || (model.GuarantorId.HasValue
|
||||||
&& x.GuarantorId == model.GuarantorId))
|
&& x.GuarantorId == model.GuarantorId))
|
||||||
?.GetViewModel;
|
?.GetViewModel;
|
||||||
|
|
||||||
}
|
}
|
||||||
public HearingViewModel? Insert(HearingBindingModel model)
|
public HearingViewModel? Insert(HearingBindingModel model)
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,7 @@ namespace LawCompanyDatabaseImplement
|
|||||||
{
|
{
|
||||||
if (optionsBuilder.IsConfigured == false)
|
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);
|
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();
|
builder.Services.AddControllersWithViews();
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
APIClient.Connect(builder.Configuration);
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
if (!app.Environment.IsDevelopment())
|
if (!app.Environment.IsDevelopment())
|
||||||
@ -22,6 +23,6 @@ app.UseAuthorization();
|
|||||||
|
|
||||||
app.MapControllerRoute(
|
app.MapControllerRoute(
|
||||||
name: "default",
|
name: "default",
|
||||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
pattern: "{controller=Home}/{action=EnterGuarantor}/{id?}");
|
||||||
|
|
||||||
app.Run();
|
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