//
        // GET: /PaymentProfile/
        public ActionResult Index()
        {
            var paymentModel = new List<PaymentProfileEditViewModel>();

            foreach (var PaymentProfile in db.PaymentProfiles.ToList())
            {
                var p = new PaymentProfileEditViewModel();
                p.PaymentProfile = PaymentProfile;
                p.CurrentPaymentRule = db.PaymentRules.Where(x => x.PaymentProfileId == PaymentProfile.PaymentProfileId).FirstOrDefault();
                paymentModel.Add(p);
            }
            return View(paymentModel);
        }
Пример #2
0
 //
 // GET: /PaymentRule/
 public ActionResult Index(int id=0)
 {
     var paymentProfile = new PaymentProfileEditViewModel();
     paymentProfile.PaymentProfile = db.PaymentProfiles.Find(id);
     var paymentRules = db.PaymentRules.Where(x => x.PaymentProfileId == id).ToList();
     var oldOrCurrent = paymentRules.Where(x => x.EffectiveDate <= DateTime.Today).OrderByDescending(x => x.CreatedDate);
     paymentProfile.OldPaymentRules = oldOrCurrent.Skip(1).Take(5).ToList();
     paymentProfile.CurrentPaymentRule = oldOrCurrent.Take(1).FirstOrDefault();
     paymentProfile.FuturePaymentRule = paymentRules.Where(x => x.EffectiveDate > DateTime.Today).FirstOrDefault();
     return PartialView(paymentProfile);
 }
 public ActionResult Edit(PaymentProfileEditViewModel pvm)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pvm.PaymentProfile).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(pvm);
 }