Exemple #1
0
 public IActionResult EditPaymentInfo(PaymentInfo payment)
 {
     if (ModelState.IsValid)
     {
         if (_paymentServices.EditPayment(payment))
         {
             Alert("Edited successfully!!", NotificationType.success);
             var search = _paymentServices.GetPayment(payment.PayId);
             if (search != null)
             {
                 return(View(search));
             }
             return(RedirectToAction("Index"));
         }
         else
         {
             Alert("Edited failed!!", NotificationType.error);
             return(View());
         }
     }
     else
     {
         Alert("Edited failed!!", NotificationType.error);
         return(View());
     }
 }
        // Phuc Check Payment Expire
        private void CheckActive(User user)
        {
            PaymentInfo item = _paymentServices.GetPaymentByUsername(user.UserName);

            if (item != null && item.DateCreated != null)
            {
                if ((item.DateCreated).Value.AddMonths(1) < DateTime.Now || item.DateExpire < DateTime.Now)
                {
                    Alert("Your Payment Info was expired. Please register again. Thank you.", NotificationType.warning);
                    item.IsActive = Status.Active;
                    _paymentServices.EditPayment(item);
                }
            }
        }