сборки с продавцами
This commit is contained in:
parent
7f6c134c57
commit
c2c4759c68
@ -3,6 +3,7 @@
|
||||
public class BuildSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public int VendorId { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public int? VendorId { get; set; }
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public int? VendorId { get; set; }
|
||||
public int? Build { get; set; }
|
||||
public int VendorId { get; set; }
|
||||
public List<int>? Builds { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ namespace ComputerHardwareStoreDatabaseImplement.Implements
|
||||
.Include(b => b.Comments)
|
||||
.Include(b => b.Components)
|
||||
.ThenInclude(b => b.Component)
|
||||
.Include(b => b.Vendor)
|
||||
.Select(b => b.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -28,6 +29,8 @@ namespace ComputerHardwareStoreDatabaseImplement.Implements
|
||||
}
|
||||
using var context = new ComputerHardwareStoreDBContext();
|
||||
return context.Builds
|
||||
.Include(b => b.Vendor)
|
||||
.Where(b => b.Vendor.Id == model.VendorId )
|
||||
.Where(b => b.Name.Contains(model.Name))
|
||||
.Include(b => b.Comments)
|
||||
.Include(b => b.Components)
|
||||
@ -44,6 +47,8 @@ namespace ComputerHardwareStoreDatabaseImplement.Implements
|
||||
}
|
||||
using var context = new ComputerHardwareStoreDBContext();
|
||||
return context.Builds
|
||||
.Include(b => b.Vendor)
|
||||
.Where(b => b.Vendor.Id == model.VendorId)
|
||||
.Include(b => b.Comments)
|
||||
.Include(b => b.Components)
|
||||
.ThenInclude(b => b.Component)
|
||||
@ -64,6 +69,7 @@ namespace ComputerHardwareStoreDatabaseImplement.Implements
|
||||
context.Builds.Add(newBuild);
|
||||
context.SaveChanges();
|
||||
return context.Builds
|
||||
.Include(b => b.Vendor)
|
||||
.Include(b => b.Comments)
|
||||
.Include(b => b.Components)
|
||||
.ThenInclude(b => b.Component)
|
||||
@ -78,6 +84,8 @@ namespace ComputerHardwareStoreDatabaseImplement.Implements
|
||||
.Include(b => b.Comments)
|
||||
.Include(b => b.Components)
|
||||
.ThenInclude(b => b.Component)
|
||||
.Include(b => b.Vendor)
|
||||
.Where(b => b.Vendor.Id == model.Vendor.Id)
|
||||
.FirstOrDefault(p => p.Id == model.Id);
|
||||
if (build == null)
|
||||
{
|
||||
@ -94,6 +102,8 @@ namespace ComputerHardwareStoreDatabaseImplement.Implements
|
||||
.Include(b => b.Comments)
|
||||
.Include(b => b.Components)
|
||||
.ThenInclude(b => b.Component)
|
||||
.Include(b => b.Vendor)
|
||||
.Where(b => b.Vendor.Id == model.Vendor.Id)
|
||||
.FirstOrDefault(p => p.Id == model.Id);
|
||||
if (build == null)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user