コード例 #1
0
        public IActionResult Index(PurchaseCourseViewModel model)
        {
            if (ModelState.IsValid)
            {
                // HACK: Validate tracking form
                var selectedCourse = _courseCtrl.GetCourseDetail(model.CourseId);
                if (selectedCourse == null) return View("Error");

                var data = new PurchaseCourseConfirmViewModel(model)
                {
                    TotalChargeAmount = selectedCourse.Price
                };
                return View("Confirm", data);
            }
            return View(model);
        }
コード例 #2
0
        public IActionResult Confirm(PurchaseCourseConfirmViewModel model)
        {
            var canAddNewCourse = _myCourseCtrl.CanAddNewCourseCatalog(User.Identity.Name, model.CourseId);
            if (!canAddNewCourse) return View("Error");

            // HACK: Validate tracking form
            // TODO: Pay with Paypal
            //addNewSubscriptionToUser(model.CourseId);
            return RedirectToAction("Finished", new { @id = "TrackingId01" });
        }