public void SaveDetail() { PaymentDetail pod = PDetails.Where(x => x.LedgerId == PDetail.LedgerId).FirstOrDefault(); if (pod == null) { pod = new PaymentDetail(); PDetails.Add(pod); } PDetail.toCopy <PaymentDetail>(pod); ClearDetail(); Amount = PDetails.Sum(x => x.Amount); }
public void SaveDetail() { if (PDetail.ProductId != 0) { PurchaseDetail pod = PDetails.Where(x => x.ProductId == PDetail.ProductId).FirstOrDefault(); if (pod == null) { pod = new PurchaseDetail(); PDetails.Add(pod); } else { PDetail.Quantity += pod.Quantity; } PDetail.toCopy <PurchaseDetail>(pod); ClearDetail(); ItemAmount = PDetails.Sum(x => x.Amount); } }