public int AddPayment(PaymentTbl pt, string Paymentno)
        {
            int returnVal = 0;

            try
            {
                Paymentno = pt.PaymentNo;

                pt.CreatedDate = DateTime.Now;
                if (pt.CreatedDate != null)
                {
                    pt.CreatedBy = "abcd";
                }

                bool existingCustomer = db.PaymentTbl.Any(x => x.PaymentNo == Paymentno);
                if (existingCustomer == true)
                {
                    returnVal = -1;
                }
                if (existingCustomer == false)
                {
                    db.PaymentTbl.Add(pt);
                    db.SaveChanges();
                }


                //return 1;
            }
            catch (Exception ex)
            {
                throw;
            }
            return(returnVal);
        }
Пример #2
0
 public PaymentTbl GetPayment(int id)
 {
     try
     {
         PaymentTbl c = db.PaymentTbl.Find(id);
         return(c);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #3
0
 public int AddPayment(PaymentTbl pt)
 {
     try
     {
         db.PaymentTbl.Add(pt);
         db.SaveChanges();
         return(1);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Пример #4
0
 public int DeletePayment(int id)
 {
     try
     {
         PaymentTbl inv = db.PaymentTbl.Find(id);
         db.PaymentTbl.Remove(inv);
         db.SaveChanges();
         return(1);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #5
0
        public int UpdatePayment(PaymentTbl pt)
        {
            try
            {
                db.Entry(pt).State = EntityState.Modified;
                db.SaveChanges();

                return(1);
            }
            catch (Exception)
            {
                throw;
            }
        }