// GET: Payment
        public ActionResult Index(int?pageNO)
        {
            int _pageNo   = pageNO ?? 1;
            var pOutGoing = db.Payments.OfType <POutGoing>().OrderByDescending(o => o.CreateTime).ToPagedList <POutGoing>(_pageNo, 11);

            PaymentIndexModel model = new PaymentIndexModel()
            {
                POutGoings   = pOutGoing,
                customers    = db.Customers.Where(w => w.CustomerActive == true).ToList(),
                CashAccounts = db.CashAccounts.ToList(),
            };

            return(View(model));
        }
        public ActionResult Create(PaymentIndexModel model)
        {
            var customerName = db.Customers.Find(model.POutGoing.CustomerId).UserName;

            if (model != null)
            {
                var pOutGoing = new POutGoing()
                {
                    CreateTime       = model.POutGoing.CreateTime,
                    Total            = model.POutGoing.Total,
                    WhichSafe        = db.CashAccounts.Find(model.CashAccountId).AccountName,
                    Description      = model.POutGoing.Description,
                    CustomerId       = model.POutGoing.CustomerId,
                    CustomerUserName = customerName,
                    WhoUser          = "******",
                    CashAccountId    = model.CashAccountId,
                };
                db.Payments.Add(pOutGoing);
                db.SaveChanges();
            }

            return(RedirectToAction("Index", "Payment"));
        }