public void DeleteDetail(string PName) { PurchaseReturnDetail pod = PRDetails.Where(x => x.ProductName == PName).FirstOrDefault(); if (pod != null) { PRDetails.Remove(pod); ItemAmount = PRDetails.Sum(x => x.Amount); } }
public void SaveDetail() { if (PRDetail.ProductId != 0) { PurchaseReturnDetail pod = PRDetails.Where(x => x.ProductId == PRDetail.ProductId).FirstOrDefault(); if (pod == null) { pod = new PurchaseReturnDetail(); PRDetails.Add(pod); } else { PRDetail.Quantity += pod.Quantity; } PRDetail.toCopy <PurchaseReturnDetail>(pod); ClearDetail(); ItemAmount = PRDetails.Sum(x => x.Amount); } }