public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PaymentType paymentType = paymentTypeRepository.GetPaymentTypeByID((int)id);

            if (paymentType == null)
            {
                return(HttpNotFound());
            }
            return(View(paymentType));
        }
예제 #2
0
        public ActionResult Create([Bind(Include = "PaymentID,Status,ClientID,PaymentTypeID")] Payment payment)
        {
            #region Seteo fecha creacion, fecha expiracion de abono y Status
            var paymentType = paymentTypeRepository.GetPaymentTypeByID(payment.PaymentTypeID);
            payment.CreationDate   = DateTime.Now;
            payment.ExpirationDate = DateTime.Now.AddMonths(paymentType.DurationInMonths);
            payment.Status         = Utils.Catalog.Status.Active;
            #endregion

            if (ModelState.IsValid)
            {
                paymentRepository.InsertPayment(payment);
                paymentRepository.Save();
                return(RedirectToAction("Index"));
            }

            ViewBag.ClientID      = new SelectList(clientRepository.GetClients(), "ClientID", "FirstName", payment.ClientID);
            ViewBag.PaymentTypeID = new SelectList(paymentTypeRepository.GetPaymentTypes(), "PaymentTypeID", "Description", payment.PaymentTypeID);
            return(View(payment));
        }