Beispiel #1
0
        /// <summary>
        /// 编辑
        /// </summary>
        /// <returns></returns>
        public ActionResult Edit(int id = 0)
        {
            if (id > 0)//禁止编辑
            {
                return(RedirectToAction("Index"));
            }
            CashVoucherBll cashVoucherBll   = new CashVoucherBll();
            CourseBll      bll              = new CourseBll();
            DtoCashVoucher voucher          = new DtoCashVoucher();
            decimal        CashVoucherLimit = -1;

            if (id > 0)
            {
                voucher = cashVoucherBll.GetVoucherById(id);
                if (voucher != null)
                {
                    var priceModel = bll.GetCoursePrice(voucher.Ycv_CourseId, CurrentUser.School.Bsl_Level);
                    if (priceModel != null)
                    {
                        CashVoucherLimit = Math.Floor(priceModel.Yce_Price * (100 - CurrentUser.School.Bhl_DividePercent) / 100);
                    }
                }
            }
            ViewBag.CashVoucherLimit = CashVoucherLimit;
            ViewBag.DividePercent    = CurrentUser.School.Bhl_DividePercent;
            return(View(voucher));
        }
        // GET: Course

        public ActionResult GetPrice(int courseId)
        {
            CourseBll bll        = new CourseBll();
            decimal   price      = 0;
            var       priceModel = bll.GetCoursePrice(courseId, CurrentUser.School.Bsl_Level);

            if (priceModel != null)
            {
                price = priceModel.Yce_Price;
            }
            return(Json(price, JsonRequestBehavior.AllowGet));
        }