This commit is contained in:
dasha 2023-05-18 19:39:29 +04:00
parent 9c61562368
commit cd21f23715
2 changed files with 2 additions and 5 deletions

View File

@ -4,8 +4,6 @@
{ {
public int? Id { get; set; } public int? Id { get; set; }
public int? PurchaseId { get; set; }
public string? BuildName { get; set; } = string.Empty; public string? BuildName { get; set; } = string.Empty;
public int? UserId { get; set; } public int? UserId { get; set; }

View File

@ -53,14 +53,13 @@ namespace HardwareShopDatabaseImplement.Implements.Worker
return null; return null;
} }
using var context = new HardwareShopDatabase(); using var context = new HardwareShopDatabase();
var dadada = context.Builds var result = context.Builds
.Include(x => x.Purchases) .Include(x => x.Purchases)
.ThenInclude(x => x.Purchase) .ThenInclude(x => x.Purchase)
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.BuildName) && x.BuildName == model.BuildName) || .FirstOrDefault(x => (!string.IsNullOrEmpty(model.BuildName) && x.BuildName == model.BuildName) ||
(model.Id.HasValue && x.Id == model.Id)) (model.Id.HasValue && x.Id == model.Id))
?.GetViewModel; ?.GetViewModel;
return dadada; return result;
} }
public BuildViewModel? Insert(BuildBindingModel model) public BuildViewModel? Insert(BuildBindingModel model)