public ActionResult UploadTechnicalVideo()
        {
            UserAuth();

            var mp4url   = RetrieveUploadVideo();
            var vsubject = Request.Form["vsubject"];
            var vdesc    = Request.Form["vdesc"];

            if (!string.IsNullOrEmpty(mp4url) && !string.IsNullOrEmpty(vsubject))
            {
                TechVideoVM.StoreVideo(vsubject, vdesc, mp4url, ViewBag.username);
            }
            return(RedirectToAction("TechnicalVideo", "TVideoSite"));
        }
        public ActionResult UploadVideoTest()
        {
            var vtests = RetrieveExcelTest();
            var vid    = Request.Form["activevid"];

            if (vtests.Count > 1)
            {
                var giftoffer  = Request.Form["giftoffer"];
                var testnotice = Request.Form["testnotice"];
                var imgpath    = RetrieveGiftImg();
                VTestVM.CleanTest(vid);


                for (var lidx = 1; lidx < vtests.Count; lidx++)
                {
                    if (!string.IsNullOrEmpty(vtests[lidx][0]) && !string.IsNullOrEmpty(vtests[lidx][2]))
                    {
                        var tempvm = new VTestVM();
                        tempvm.VID         = vid;
                        tempvm.TestID      = TechVideoVM.GetUniqKey();
                        tempvm.TestNotice  = testnotice;
                        tempvm.GiftOffer   = giftoffer;
                        tempvm.GiftPath    = imgpath;
                        tempvm.TestContent = vtests[lidx][0];
                        tempvm.TestType    = vtests[lidx][1];
                        tempvm.Answer      = vtests[lidx][2];

                        var aw = new List <string>();
                        for (var idx = 0; idx < 6; idx++)
                        {
                            aw.Add(vtests[lidx][idx + 3]);
                        }
                        tempvm.OptionalAnswers = Newtonsoft.Json.JsonConvert.SerializeObject(aw);
                        tempvm.StoreTestVM();
                    }
                }//end for
            }
            var routedict = new RouteValueDictionary();

            routedict.Add("activeid", vid);
            return(RedirectToAction("TechnicalVideo", "TVideoSite", routedict));
        }
        public ActionResult TechnicalVideo(string activeid, string searchkey)
        {
            UserAuth();

            if (string.Compare(ViewBag.username, ViewBag.compName) == 0)
            {
                return(RedirectToAction("Welcome"));
            }

            var vm = TechVideoVM.RetrieveVideo(searchkey);

            if (vm.Count > 0)
            {
                RetrieveVideoTile(vm);
                if (string.IsNullOrEmpty(activeid))
                {
                    ViewBag.ActiveVideo = vm[0];
                }
                else
                {
                    foreach (var item in vm)
                    {
                        if (string.Compare(activeid, item.VID) == 0)
                        {
                            ViewBag.ActiveVideo = item;
                        }
                    }
                    if (ViewBag.ActiveVideo == null)
                    {
                        ViewBag.ActiveVideo = vm[0];
                    }
                }

                if (ViewBag.ActiveVideo != null)
                {
                    ViewBag.ActiveVideo.TestList = VTestVM.RetrieveRandomTest(ViewBag.ActiveVideo.VID, 10);
                }
            }

            return(View(vm));
        }