fix
This commit is contained in:
parent
25607a573b
commit
d258735aae
@ -68,7 +68,7 @@ namespace SoftwareInstallationDatabaseImplement.Models
|
||||
var context = new SoftwareInstallationDatabase();
|
||||
return new()
|
||||
{
|
||||
PackageName = context.Packages.FirstOrDefault(x => x.Id == PackageId)?.PackageName ?? string.Empty,
|
||||
PackageName = Package?.PackageName ?? string.Empty,
|
||||
PackageId = PackageId,
|
||||
Count = Count,
|
||||
Sum = Sum,
|
||||
|
@ -1,4 +1,5 @@
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using SoftwareInstallationContracts.SearchModels;
|
||||
using SoftwareInstallationContracts.StoragesContracts;
|
||||
using SoftwareInstallationContracts.ViewModels;
|
||||
@ -28,7 +29,9 @@ namespace SoftwareInstallationDatabaseImplement.Implements
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return context.Orders.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)?.GetViewModel;
|
||||
return context.Orders
|
||||
.Include(x => x.Package)
|
||||
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
@ -41,6 +44,7 @@ namespace SoftwareInstallationDatabaseImplement.Implements
|
||||
{
|
||||
using var context = new SoftwareInstallationDatabase();
|
||||
return context.Orders
|
||||
.Include(x => x.Package)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -61,7 +65,7 @@ namespace SoftwareInstallationDatabaseImplement.Implements
|
||||
public OrderViewModel? Update(OrderBindingModel model)
|
||||
{
|
||||
using var context = new SoftwareInstallationDatabase();
|
||||
var order = context.Orders.FirstOrDefault(x => x.Id == model.Id);
|
||||
var order = context.Orders.Include(x => x.Package).FirstOrDefault(x => x.Id == model.Id);
|
||||
if (order == null)
|
||||
{
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user