Exemplo n.º 1
0
        public async Task <ActionResult <PDetails> > PostPDetails(PDetails pDetails)
        {
            _context.PDetails.Add(pDetails);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPDetails", new { id = pDetails.PId }, pDetails));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutPDetails(int id, PDetails pDetails)
        {
            if (id != pDetails.PId)
            {
                return(BadRequest());
            }

            _context.Entry(pDetails).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PDetailsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 3
0
        public void FindDetail(int LedgerId)
        {
            PaymentDetail pod = PDetails.Where(x => x.LedgerId == LedgerId).FirstOrDefault();

            if (pod != null)
            {
                pod.toCopy <PaymentDetail>(PDetail);
            }
        }
Exemplo n.º 4
0
        public void DeleteDetail(int LedgerId)
        {
            PaymentDetail pod = PDetails.Where(x => x.LedgerId == LedgerId).FirstOrDefault();

            if (pod != null)
            {
                PDetails.Remove(pod);
                Amount = PDetails.Sum(x => x.Amount);
            }
        }
Exemplo n.º 5
0
        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);
            }
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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);
            }
        }