public async Task <IActionResult> Edit(string id, [Bind("CC_CD_NO,CC_CD_LINE_NO,CC_FORMAL_CONT_NO,REP_PERIOD,CC_AMOUNT,CC_CREDIT_CARD_NO,CC_APPROVAL_CODE,CC_DEBIT_VOUCHER_NO,DT_DV,CC_CYCLE_DATE,NEAR_BATCH_NO,CC_DATE_ADDED,CC_INTERNAL_TYPE")] rpt_Credit_Card_Trans rpt_Credit_Card_Trans)
        {
            if (id != rpt_Credit_Card_Trans.CC_CD_NO)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(rpt_Credit_Card_Trans);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!rpt_Credit_Card_TransExists(rpt_Credit_Card_Trans.CC_CD_NO))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(rpt_Credit_Card_Trans));
        }
        /// <summary>
        /// Search by Credit Card Line Number
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public IActionResult ListCreditCardTrans(rpt_Credit_Card_Trans model)
        {
            ///  LINQ.  The search is based on model.CC_CD_LINE_NO
            /// See LINQ Reference document --
            /// https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/getting-started-with-linq
            ///
            var queryCreditCard = _context.rpt_Credit_Card_Trans
                                  .Where(c => c.CC_CD_LINE_NO == model.CC_CD_LINE_NO)
                                  .Select(c => new rpt_Credit_Card_Trans()
            {
                CC_CD_NO            = c.CC_CD_NO,
                CC_CD_LINE_NO       = c.CC_CD_LINE_NO,
                CC_FORMAL_CONT_NO   = c.CC_FORMAL_CONT_NO,
                REP_PERIOD          = c.REP_PERIOD,
                CC_AMOUNT           = c.CC_AMOUNT,
                CC_CREDIT_CARD_NO   = c.CC_CREDIT_CARD_NO,
                CC_APPROVAL_CODE    = c.CC_APPROVAL_CODE,
                CC_DEBIT_VOUCHER_NO = c.CC_DEBIT_VOUCHER_NO,
                DT_DV            = c.DT_DV,
                CC_CYCLE_DATE    = c.CC_CYCLE_DATE,
                NEAR_BATCH_NO    = c.NEAR_BATCH_NO,
                CC_DATE_ADDED    = c.CC_DATE_ADDED,
                CC_INTERNAL_TYPE = c.CC_INTERNAL_TYPE
            }
                                          );

            // return query result queryCreditCard modle to ListCreditCardTrans page
            return(View(queryCreditCard));
        }
        public async Task <IActionResult> Create([Bind("CC_CD_NO,CC_CD_LINE_NO,CC_FORMAL_CONT_NO,REP_PERIOD,CC_AMOUNT,CC_CREDIT_CARD_NO,CC_APPROVAL_CODE,CC_DEBIT_VOUCHER_NO,DT_DV,CC_CYCLE_DATE,NEAR_BATCH_NO,CC_DATE_ADDED,CC_INTERNAL_TYPE")] rpt_Credit_Card_Trans rpt_Credit_Card_Trans)
        {
            if (ModelState.IsValid)
            {
                _context.Add(rpt_Credit_Card_Trans);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(rpt_Credit_Card_Trans));
        }