public ActionResult Edit(VideoCourse videoCourse)
 {
     if (ModelState.IsValid)
     {
         unitOfWork.videoCoursesRepository.Update(videoCourse);
         unitOfWork.Save();
         return(RedirectToAction("Index", "VideoCourse"));
     }
     return(View(videoCourse));
 }
Пример #2
0
        //
        // GET: /CourseList/
        public ActionResult Content(int id)
        {
            VideoCourse videoCourse = unitOfWork.videoCoursesRepository.GetByID(id);

            if (videoCourse == null)
            {
                return(HttpNotFound());
            }
            return(View(videoCourse));
        }
        public ActionResult Edit(int id)
        {
            CategoryService cate = new CategoryService();

            ViewData["Categorylist"] = cate.GetCategorySelectList(5);
            VideoCourse videoCourse = unitOfWork.videoCoursesRepository.GetByID(id);

            if (videoCourse == null)
            {
                return(HttpNotFound());
            }
            return(View(videoCourse));
        }
        public ActionResult Create(VideoCourse videoCourse)
        {
            CategoryService cate = new CategoryService();

            ViewData["Categorylist"] = cate.GetCategorySelectList(5);
            if (ModelState.IsValid)
            {
                unitOfWork.videoCoursesRepository.Insert(videoCourse);
                unitOfWork.Save();
                return(RedirectToAction("Index", "VideoCourse"));
            }

            return(View(videoCourse));
        }
Пример #5
0
        public ActionResult Content(int id)
        {
            VideoCourse video  = unitOfWork.videoCoursesRepository.GetByID(id);
            string      ApiUrl = AliyunCommonParaConfig.ApiUrl;
            // 注意这里需要使用UTC时间,比北京时间少8小时。
            string Timestamp      = DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ", DateTimeFormatInfo.InvariantInfo);
            string Action         = "GetVideoPlayAuth";
            string SignatureNonce = CommonTools.EncryptToSHA1(CommonTools.GenerateRandomNumber(8));

            //  string VideoId = "6ccf973fe06741e49ab849d4cec017e0";

            string VideoId = video.VideoId;

            ViewBag.VideoId = VideoId;

            ViewBag.PlayAuth = AliyunVideoServices.GetVideoInfo(ApiUrl, VideoId, Timestamp, Action, SignatureNonce).PlayAuth;

            return(View(video));
        }