Пример #1
0
        public ActionResult Edit(int id)
        {
            var videoTVC = _videoTVCRepository.Find(id);

            if (videoTVC != null)
            {
                ViewBag.ProductId      = new SelectList(_videoTVCRepository.AllProduct.Where(p => p.CompanyId == videoTVC.Product.CompanyId).ToList(), "Id", "Name", videoTVC.ProductId);
                ViewBag.CompanyId      = new SelectList(_videoTVCRepository.AllCompany.ToList(), "Id", "Name", videoTVC.Product.CompanyId);
                ViewBag.ProductGroupId = new SelectList(_videoTVCRepository.AllProductGroup.ToList(), "Id", "Name", videoTVC.ProductGroupId);
                ViewBag.CompanyGroupId = new SelectList(_videoTVCRepository.AllCompanyGroup.ToList(), "Id", "Name", videoTVC.CompanyGroupId);
                return(PartialView(videoTVC));
            }

            return(new HttpNotFoundResult("Không tìm thấy trang yêu cầu"));
        }
Пример #2
0
        public ActionResult EditTvc(int[] tvcList, int catId)
        {
            var cat = _videocategoryRepository.Find(catId);

            cat.VideoTVCs.Clear();
            if (tvcList != null)
            {
                for (int i = 0; i < tvcList.Length; i++)
                {
                    var tvc = _tvcRepository.Find(tvcList[i]);
                    cat.VideoTVCs.Add(tvc);
                }
            }
            _videocategoryRepository.Save();
            return(RedirectToAction("Edit", new { id = catId }));
        }