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