Фальшивого дрессировщика в цирке быстро раскусили.
This commit is contained in:
parent
5e273fd259
commit
14a26c2765
@ -5,5 +5,8 @@
|
|||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public string? Title { get; set; }
|
public string? Title { get; set; }
|
||||||
public int? UserId { get; set; }
|
public int? UserId { get; set; }
|
||||||
|
public int? WorkerId { get; set; }
|
||||||
|
public DateTime? DateFrom { get; set; }
|
||||||
|
public DateTime? DateTo { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,6 @@ namespace Contracts.SearchModels
|
|||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
public int? UserId { get; set; }
|
public int? UserId { get; set; }
|
||||||
public int? MachineId { get; set; }
|
public int? MachineId { get; set; }
|
||||||
public int? DetailId { get; set; }
|
public int? WorkerId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,5 +6,7 @@
|
|||||||
public string? Title { get; set; }
|
public string? Title { get; set; }
|
||||||
public int? UserId { get; set; }
|
public int? UserId { get; set; }
|
||||||
public int? DetailId { get; set; }
|
public int? DetailId { get; set; }
|
||||||
|
public DateTime? DateFrom { get; set; }
|
||||||
|
public DateTime? DateTo { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,15 @@ namespace DatabaseImplement.Implements
|
|||||||
|
|
||||||
public List<MachineViewModel> GetFilteredList(MachineSearchModel model)
|
public List<MachineViewModel> GetFilteredList(MachineSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.UserId.HasValue)
|
if (!model.UserId.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
using var context = new FactoryGoWorkDatabase();
|
using var context = new FactoryGoWorkDatabase();
|
||||||
return context.Machines.Include(p => p.Workers).ThenInclude(p => p.Worker).Where(x => x.UserId == model.Id).Select(x => x.GetViewModel).ToList();
|
if (model.DateFrom.HasValue)
|
||||||
|
return context.Machines.Where(x => x.UserId == model.Id).Where(x => x.DateCreate < model.DateTo && x.DateCreate > model.DateFrom).Select(x => x.GetViewModel).ToList();
|
||||||
|
else
|
||||||
|
return context.Machines.Where(x => x.UserId == model.Id).Select(x => x.GetViewModel).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MachineViewModel> GetFullList()
|
public List<MachineViewModel> GetFullList()
|
||||||
|
@ -29,13 +29,13 @@ namespace DatabaseImplement.Implements
|
|||||||
|
|
||||||
public List<ProductViewModel> GetFilteredList(ProductSearchModel model)
|
public List<ProductViewModel> GetFilteredList(ProductSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.UserId.HasValue && !model.DetailId.HasValue)
|
if (!model.UserId.HasValue && !model.WorkerId.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
using var context = new FactoryGoWorkDatabase();
|
using var context = new FactoryGoWorkDatabase();
|
||||||
if (model.DetailId.HasValue)
|
if (model.WorkerId.HasValue)
|
||||||
return context.Products.Include(p => p.Details).ThenInclude(p => p.Detail).Where(x => x.UserId == model.Id).Where(x => x.Details.FirstOrDefault(y => y.DetailId == model.DetailId) != null).Select(x => x.GetViewModel).ToList();
|
return context.Products.Include(p => p.Details).ThenInclude(p => p.Detail).Where(x => x.UserId == model.Id).Where(x => x.Details.FirstOrDefault(y => y.DetailId == model.WorkerId) != null).Select(x => x.GetViewModel).ToList();
|
||||||
else
|
else
|
||||||
return context.Products.Include(p => p.Details).ThenInclude(p => p.Detail).Where(x => x.UserId == model.Id).Select(x => x.GetViewModel).ToList();
|
return context.Products.Include(p => p.Details).ThenInclude(p => p.Detail).Where(x => x.UserId == model.Id).Select(x => x.GetViewModel).ToList();
|
||||||
}
|
}
|
||||||
|
@ -30,15 +30,15 @@ namespace DatabaseImplement.Implements
|
|||||||
|
|
||||||
public List<WorkshopViewModel> GetFilteredList(WorkshopSearchModel model)
|
public List<WorkshopViewModel> GetFilteredList(WorkshopSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.UserId.HasValue && !model.DetailId.HasValue)
|
if (!model.UserId.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
using var context = new FactoryGoWorkDatabase();
|
using var context = new FactoryGoWorkDatabase();
|
||||||
if (model.DetailId.HasValue)
|
if (model.DateFrom.HasValue)
|
||||||
return context.Workshops.Where(x => x.ProductionId != null).Include(x => x.Production).Where(x => x.Production!.Details.FirstOrDefault(y => y.DetailId == model.DetailId) != null).Where(x => x.UserId == model.UserId).Select(x => x.GetViewModel).ToList();
|
return context.Workshops.Where(x => x.UserId == model.Id).Where(x => x.DateCreate < model.DateTo && x.DateCreate > model.DateFrom).Select(x => x.GetViewModel).ToList();
|
||||||
else
|
else
|
||||||
return context.Workshops.Include(x => x.Workers).ThenInclude(x => x.Worker).Where(x => x.UserId == model.UserId).Select(x => x.GetViewModel).ToList();
|
return context.Workshops.Where(x => x.UserId == model.Id).Select(x => x.GetViewModel).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<WorkshopViewModel> GetFullList()
|
public List<WorkshopViewModel> GetFullList()
|
||||||
|
@ -19,6 +19,8 @@ namespace DatabaseImplement.Models
|
|||||||
public string Title { get; private set; } = string.Empty;
|
public string Title { get; private set; } = string.Empty;
|
||||||
[Required]
|
[Required]
|
||||||
public string Country { get; private set; } = string.Empty;
|
public string Country { get; private set; } = string.Empty;
|
||||||
|
[Required]
|
||||||
|
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||||
[Required]
|
[Required]
|
||||||
public int UserId { get; private set; }
|
public int UserId { get; private set; }
|
||||||
private Dictionary<int, IWorkerModel>? _workerMachines = null;
|
private Dictionary<int, IWorkerModel>? _workerMachines = null;
|
||||||
|
@ -15,6 +15,8 @@ namespace DatabaseImplement.Models
|
|||||||
public string Address { get; set; } = string.Empty;
|
public string Address { get; set; } = string.Empty;
|
||||||
[Required]
|
[Required]
|
||||||
public string Director { get; set; } = string.Empty;
|
public string Director { get; set; } = string.Empty;
|
||||||
|
[Required]
|
||||||
|
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||||
[Required]
|
[Required]
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
public int? ProductionId { get; set; }
|
public int? ProductionId { get; set; }
|
||||||
|
@ -14,3 +14,8 @@ ProductionStorage productionionStorage = new ProductionStorage();
|
|||||||
ProductStorage productStorage = new ProductStorage();
|
ProductStorage productStorage = new ProductStorage();
|
||||||
MachineStorage machineStorage = new MachineStorage();
|
MachineStorage machineStorage = new MachineStorage();
|
||||||
GuarantorStorage guarantorStorage = new GuarantorStorage();
|
GuarantorStorage guarantorStorage = new GuarantorStorage();
|
||||||
|
WorkerStorage workerStorage = new WorkerStorage();
|
||||||
|
WorkshopStorage workshopStorage = new WorkshopStorage();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user