обновление суммы
This commit is contained in:
parent
3dd37697c8
commit
e7fff05911
@ -4,6 +4,7 @@ using HardwareShopDatabaseImplement.Models.ManyToMany;
|
||||
using HardwareShopDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace HardwareShopDatabaseImplement.Models.Worker
|
||||
{
|
||||
@ -98,10 +99,24 @@ namespace HardwareShopDatabaseImplement.Models.Worker
|
||||
Purchase = context.Purchases.First(x => x.Id == bp.Key),
|
||||
Count = bp.Value.Item2
|
||||
});
|
||||
var purchase = context.Purchases.First(x => x.Id == bp.Key);
|
||||
if (purchase != null)
|
||||
{
|
||||
purchase.Sum += bp.Value.Item2* build.Price;
|
||||
}
|
||||
context.SaveChanges();
|
||||
|
||||
}
|
||||
_buildPurchases = null;
|
||||
}
|
||||
|
||||
|
||||
public void UpdateSumPurchase(HardwareShopDatabase context, BuildBindingModel model)
|
||||
{
|
||||
var buildPurchases = context.PurchasesBuilds.Where(rec => rec.BuildId == model.Id).ToList();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user