public void DeleteDetail(string PName) { PurchaseDetail pod = PDetails.Where(x => x.ProductName == PName).FirstOrDefault(); if (pod != null) { PDetails.Remove(pod); ItemAmount = 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); } }
public void ClearDetail() { PurchaseDetail pod = new PurchaseDetail(); pod.toCopy <PurchaseDetail>(PDetail); }