SomeWorkshopReportImplementer
Work it harder, make it better Do it faster, makes us stronger More than ever, hour after hour Work is never over
This commit is contained in:
parent
24ab0decab
commit
1a18c24f37
@ -5,5 +5,6 @@
|
||||
public int? Id { get; set; }
|
||||
public string? Title { get; set; }
|
||||
public int? UserId { get; set; }
|
||||
public int? DetailId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -30,12 +30,15 @@ namespace DatabaseImplement.Implements
|
||||
|
||||
public List<WorkshopViewModel> GetFilteredList(WorkshopSearchModel model)
|
||||
{
|
||||
if (!model.UserId.HasValue)
|
||||
if (!model.UserId.HasValue && !model.DetailId.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new FactoryGoWorkDatabase();
|
||||
return context.Workshops.Include(x => x.Workers).ThenInclude(x => x.Worker).Where(x => x.UserId == model.UserId).Select(x => x.GetViewModel).ToList();
|
||||
if (model.DetailId.HasValue)
|
||||
return context.Workshops.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();
|
||||
else
|
||||
return context.Workshops.Include(x => x.Workers).ThenInclude(x => x.Worker).Where(x => x.UserId == model.UserId).Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public List<WorkshopViewModel> GetFullList()
|
||||
|
@ -1,5 +1,4 @@
|
||||
using AspNetCore;
|
||||
using Contracts.BusinessLogicsContracts;
|
||||
using Contracts.BusinessLogicsContracts;
|
||||
using Contracts.ViewModels;
|
||||
using GuarantorAPP.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
@ -161,13 +161,13 @@ namespace ImplementerApp.Controllers
|
||||
{
|
||||
DetailName = "Деталь А",
|
||||
Productions = new List<string> { "Производство 1", "Производство 2" },
|
||||
Machines = new List<string> { "Машина X", "Машина Y" }
|
||||
Products = new List<string> { "Машина X", "Машина Y" }
|
||||
},
|
||||
new DetailTimeReport
|
||||
{
|
||||
DetailName = "Деталь B",
|
||||
Productions = new List<string> { "Производство 3", "Производство 4" },
|
||||
Machines = new List<string> { "Машина Z", "Машина W" }
|
||||
Products = new List<string> { "Машина Z", "Машина W" }
|
||||
}
|
||||
};
|
||||
return View(detailTimeReports);
|
||||
|
Loading…
Reference in New Issue
Block a user