Esempio n. 1
0
        public ActionResult Update(Album obj, HttpPostedFileBase file)
        {
            AlbumDAO dao = new AlbumDAO();

            if (file != null && file.ContentLength > 0)
            {
                string fileName = Path.GetFileNameWithoutExtension(file.FileName);
                fileName += "_" + obj.IdAlbum;
                fileName += Path.GetExtension(file.FileName);

                string folderPath  = Server.MapPath("~") + @"\Assets\images\ImagesOutSource\ImagesSong";
                string folderPath2 = Server.MapPath("~") + @"\Assets\images\ImagesOutSource\Album";

                if (!Directory.Exists(folderPath))
                {
                    Directory.CreateDirectory(folderPath);
                }

                string path  = Path.Combine(folderPath, fileName);
                string path2 = Path.Combine(folderPath2, fileName);

                file.SaveAs(path);
                file.SaveAs(path2);
                obj.AnhAlbum = fileName;
                if (dao.UpdateAlbum(obj))
                {
                    return(RedirectToAction("Index", "Album"));
                }
                else
                {
                    ModelState.AddModelError("", "Error");
                    return(View(obj.IdAlbum));
                }
            }
            else
            {
                ModelState.AddModelError("", "Bạn phải nhập vào trường này");
            }
            NgheSiDAO nsDAO = new NgheSiDAO();
            var       ns    = nsDAO.Listof();
            KhuVucDAO kvDAO = new KhuVucDAO();
            var       kv    = kvDAO.ListOf();

            ViewBag.ns = ns;
            ViewBag.kv = kv;
            return(View());
            //try
            //{
            //    AlbumDAO dao = new AlbumDAO();
            //    if (dao.UpdateAlbum(ab))
            //    {
            //        return RedirectToAction("Index", "Album");
            //    }
            //    else
            //    {
            //        ModelState.AddModelError("", "Error");
            //        return View(ab.IdAlbum);
            //    }
        }
        public ActionResult AddNew()
        {
            KhuVucDAO kvDAO = new KhuVucDAO();
            var       kv    = kvDAO.ListOf();

            ViewBag.kv = kv;
            return(View());
        }
Esempio n. 3
0
        public ActionResult Addalbum()
        {
            NgheSiDAO nsDAO = new NgheSiDAO();
            var       ns    = nsDAO.Listof();
            KhuVucDAO kvDAO = new KhuVucDAO();
            var       kv    = kvDAO.ListOf();

            ViewBag.ns = ns;
            ViewBag.kv = kv;
            return(View());
        }
Esempio n. 4
0
        public ActionResult AddNew()
        {
            NgheSiDAO nsdao = new NgheSiDAO();
            var       ns    = nsdao.Listof();
            KhuVucDAO kvdao = new KhuVucDAO();
            var       kv    = kvdao.ListOf();

            ViewBag.ns = ns;
            ViewBag.kv = kv;
            return(View());
        }
        public ActionResult Update(int id)
        {
            KhuVucDAO kvDAO = new KhuVucDAO();
            var       kv    = kvDAO.ListOf();

            ViewBag.kv = kv;
            NgheSiDAO dao = new NgheSiDAO();
            var       up  = dao.Detail(id);

            return(View(up));
        }
Esempio n. 6
0
        public ActionResult Update(int id)
        {
            NgheSiDAO nsdao = new NgheSiDAO();
            var       ns    = nsdao.Listof();
            KhuVucDAO kvdao = new KhuVucDAO();
            var       kv    = kvdao.ListOf();

            ViewBag.ns = ns;
            ViewBag.kv = kv;
            var ud = dao.GetVideoById(id);

            return(View(ud));
        }
        public ActionResult AddNew(NgheSi obj, HttpPostedFileBase file)
        {
            try
            {
                NgheSiDAO dao = new NgheSiDAO();

                if (file != null && file.ContentLength > 0)
                {
                    string fileName = Path.GetFileNameWithoutExtension(file.FileName);
                    fileName += "_" + obj.IdNgheSi;
                    fileName += Path.GetExtension(file.FileName);

                    string folderPath  = Server.MapPath("~") + @"\Areas\Admin\Asset\ImagesOutSource\imgsinger";
                    string folderPath2 = Server.MapPath("~") + @"\Assets\images\ImagesOutSource\ImagesSing";

                    if (!Directory.Exists(folderPath))
                    {
                        Directory.CreateDirectory(folderPath);
                    }

                    string path  = Path.Combine(folderPath, fileName);
                    string path2 = Path.Combine(folderPath2, fileName);

                    file.SaveAs(path);
                    file.SaveAs(path2);
                    obj.AnhNgheSi = fileName;
                    int id = dao.AddNew(obj);
                    if (id != -1)
                    {
                        return(RedirectToAction("Index", "NgheSi"));
                    }
                    else
                    {
                        ViewBag.Message("Them moi khong thanh cong");
                        return(RedirectToAction("AddNew", "NgheSi"));
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Bạn phải nhập vào trường này");
                }
            }
            catch
            {
            }
            KhuVucDAO kvDAO = new KhuVucDAO();
            var       kv    = kvDAO.ListOf();

            ViewBag.kv = kv;
            return(View());
        }
Esempio n. 8
0
        public ActionResult Update(int id)
        {
            AlbumDAO  dao   = new AlbumDAO();
            NgheSiDAO nsDAO = new NgheSiDAO();
            var       ns    = nsDAO.Listof();
            KhuVucDAO kvDAO = new KhuVucDAO();
            var       kv    = kvDAO.ListOf();

            ViewBag.ns = ns;
            ViewBag.kv = kv;
            var up = dao.Detail(id);

            return(View(up));
        }
Esempio n. 9
0
        public ActionResult NgheSiTheoKhuVuc(int IdKhuVuc)
        {
            KhuVucDAO kv    = new KhuVucDAO();
            var       allkv = kv.ListOf();

            ViewBag.TatCaKhuVuc = allkv;
            NgheSiDAO     ns     = new NgheSiDAO();
            List <object> kvList = new List <object>();
            var           x      = ns.LocNgheSiTheoKhuVuc(IdKhuVuc);

            kvList.Add(x);
            ViewBag.KhuVuc           = kvList;
            ViewBag.NgheSiTheoKhuVuc = x;
            return(View());
        }
Esempio n. 10
0
        // GET: NgheSi
        public ActionResult Index()
        {
            NgheSiDAO ns           = new NgheSiDAO();
            var       nghesinoibat = ns.ListNgheSiHot();

            ViewBag.NgheSiHot = nghesinoibat;
            var tatcanghesi = ns.Listof();

            ViewBag.TatCaNgheSi = tatcanghesi;
            KhuVucDAO kv     = new KhuVucDAO();
            var       khuvuc = kv.ListOf();

            ViewBag.KhuVuc = khuvuc;
            return(View());
        }
Esempio n. 11
0
        public ActionResult AddNew(Video obj, HttpPostedFileBase videofile, HttpPostedFileBase file)
        {
            try
            {
                if (videofile != null && videofile.ContentLength > 0 && file.ContentLength > 0)
                {
                    string fileName = Path.GetFileNameWithoutExtension(videofile.FileName);
                    fileName += "_" + obj.IdVideo;
                    fileName += Path.GetExtension(videofile.FileName);

                    string folderPath = Server.MapPath("~") + @"\VideoDowLoad";

                    if (!Directory.Exists(folderPath))
                    {
                        Directory.CreateDirectory(folderPath);
                    }

                    string path = Path.Combine(folderPath, fileName);

                    videofile.SaveAs(path);
                    obj.LinkVideoMp4 = fileName;
                    string fileName1 = Path.GetFileNameWithoutExtension(file.FileName);
                    fileName1 += "_" + obj.IdVideo;
                    fileName1 += Path.GetExtension(file.FileName);

                    string folderPath1 = Server.MapPath("~") + @"\Assets\images\PosterVideo";

                    if (!Directory.Exists(folderPath1))
                    {
                        Directory.CreateDirectory(folderPath1);
                    }

                    string path1 = Path.Combine(folderPath1, fileName1);

                    file.SaveAs(path1);
                    obj.Poster = fileName1;
                    int id = dao.AddNew(obj);
                    if (id != -1)
                    {
                        return(RedirectToAction("Index", "Video"));
                    }
                    else
                    {
                        ViewBag.Message("Them moi khong thanh cong");
                        return(RedirectToAction("AddNew", "Video"));
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Bạn phải nhập vào trường này");
                }
            }
            catch
            {
            }
            NgheSiDAO nsdao = new NgheSiDAO();
            var       ns    = nsdao.Listof();
            KhuVucDAO kvdao = new KhuVucDAO();
            var       kv    = kvdao.ListOf();

            ViewBag.ns = ns;
            ViewBag.kv = kv;
            return(View());
        }