public ActionResult Edit(VideosSettingViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var model = this.vodpointsdb.videossettings.First();
                model.AutoReplay = viewModel.AutoReplay;
                model.PreviewTime = viewModel.PreviewTime;

                var encoderIdList = new List<string>();
                var encoderSettingNameList = viewModel.EncoderSettingsCheckBox.Where(a => a.Checked).Select(a => a.Text).ToList();
                foreach (var item in this.vodpointsdb.encodersettings)
                {
                    if (encoderSettingNameList.Contains(item.EncoderSettingName))
                    {
                        encoderIdList.Add(item.Id.ToString());
                    }
                }

                model.EncoderSettingId = string.Join(",", encoderIdList.ToArray());
                this.vodpointsdb.Entry(model).State = EntityState.Modified;
                this.vodpointsdb.SaveChanges();
            }

            return RedirectToAction("Index");
        }
        public ActionResult Index()
        {
            var videossettings = this.vodpointsdb.videossettings.First();
            var encoderIds = videossettings.EncoderSettingId.Split(',').Select(int.Parse).ToList();
            var parentIds = this.vodpointsdb.encodersettings.Select(a => (int)a.Id).ToList();
            var model = new VideosSettingViewModel();

            foreach (var encoderSetting in this.vodpointsdb.encodersettings)
            {
                model.EncoderSettingsCheckBox.Add(new CheckBox { Text = encoderSetting.EncoderSettingName, Checked = encoderIds.Contains((int)encoderSetting.Id) });
            }

            model.AutoReplay = videossettings.AutoReplay;
            for (int i = 1; i <= 5; i++)
            {
                model.PreviewTimeListItem.Add(new SelectListItem { Text = string.Format("{0}分鐘", i), Value = i.ToString(), Selected = videossettings.PreviewTime == i });
            }

            model.PreviewTime = videossettings.PreviewTime;
            return View(model);
        }