// GET: Admin/NgheSi
        public ActionResult Index()
        {
            NgheSiDAO dao    = new NgheSiDAO();
            var       result = dao.Listof();

            return(View(result));
        }
Example #2
0
        // GET: Home
        public ActionResult Index()
        {
            //Danh Sach Tat Ca Bai Hat
            BaiHatDAO     bh = new BaiHatDAO();
            List <BaiHat> ls = bh.ListOf();

            ViewBag.NgheGanDay = ls;
            //Top 15 bai hat hay nhat
            var top15 = bh.Top15();

            ViewBag.Top15 = top15;
            //Nghệ Sĩ Nổi Bật
            NgheSiDAO ns        = new NgheSiDAO();
            var       NgheSiHot = ns.ListNgheSiHot();

            ViewBag.NgheSiNoiBat = NgheSiHot;
            //BaiHatMoiPhatHanh
            var mph = bh.MoiPhatHanh();

            ViewBag.MoiPhatHanh = mph;
            //Album Hot
            AlbumDAO al    = new AlbumDAO();
            var      album = al.AlbumHot();

            ViewBag.AlbumHot = album;
            //Thể Loại
            TheLoaiDAO tl      = new TheLoaiDAO();
            var        theloai = tl.TheLoaiListIEnnumable();

            ViewBag.TheLoai = theloai;
            return(View());
        }
Example #3
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 Delete(int id)
        {
            NgheSiDAO dao = new NgheSiDAO();

            dao.Delete(id);

            return(RedirectToAction("Index", "NgheSi"));
        }
        public ActionResult Update(BaiHat obj, HttpPostedFileBase file, FormCollection f)
        {
            BaiHatDAO dao = new BaiHatDAO();

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

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

                    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.AnhBaiHat = fileName;
                    obj.IdNgheSi  = Convert.ToInt32(f["getNgheSi"]);
                    if (dao.Update(obj))
                    {
                        return(RedirectToAction("Index", "AdBaiHat"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Error");
                        return(View(obj.IdBaiHat));
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Bạn phải nhập vào trường này");
                }
            }
            catch
            {
            }
            TheLoaiDAO tldao    = new TheLoaiDAO();
            var        category = tldao.ListOf();
            NgheSiDAO  nsdao    = new NgheSiDAO();
            var        nghesi   = nsdao.Listof();
            AlbumDAO   abdao    = new AlbumDAO();
            var        album    = abdao.Listof();

            ViewBag.category = category;
            ViewBag.nghesi   = nghesi;
            ViewBag.album    = album;
            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));
        }
Example #7
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());
        }
Example #8
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());
        }
Example #9
0
        public ActionResult ThongTin(int idNgheSi)
        {
            NgheSiDAO ns     = new NgheSiDAO();
            var       ngheSi = ns.GetNgheSiById(idNgheSi);
            BaiHatDAO bh     = new BaiHatDAO();
            var       dsbh   = bh.GetBaiHatByIdNgheSi(idNgheSi);

            ViewBag.BaiHatTheoNgheSi = dsbh;
            //Nghệ Sĩ Khác
            ViewBag.NgheSiKhac = ns.ListNgheSiHot().Where(x => x.IdNgheSi != idNgheSi).ToList();
            return(View(ngheSi));
        }
Example #10
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());
        }
Example #12
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));
        }
Example #13
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());
        }
        public ActionResult Add()
        {
            TheLoaiDAO tldao    = new TheLoaiDAO();
            var        category = tldao.ListOf();
            NgheSiDAO  nsdao    = new NgheSiDAO();
            var        nghesi   = nsdao.Listof();
            AlbumDAO   abdao    = new AlbumDAO();
            var        album    = abdao.Listof();

            ViewBag.category = category;
            ViewBag.nghesi   = nghesi;
            ViewBag.album    = album;

            return(View());
        }
Example #15
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());
        }
        public ActionResult Update(int id)
        {
            TheLoaiDAO tldao    = new TheLoaiDAO();
            var        category = tldao.ListOf();
            NgheSiDAO  nsdao    = new NgheSiDAO();
            var        nghesi   = nsdao.Listof();
            AlbumDAO   abdao    = new AlbumDAO();
            var        album    = abdao.Listof();

            ViewBag.category = category;
            ViewBag.nghesi   = nghesi;
            ViewBag.album    = album;
            BaiHatDAO dao = new BaiHatDAO();
            var       rs  = dao.Detail(id);

            return(View(rs));
        }
        public ActionResult Add(BaiHat obj, NgheSi obj2, HttpPostedFileBase file, HttpPostedFileBase fileMusic, FormCollection f)
        {
            NgheSiDAO dao2 = new NgheSiDAO();
            BaiHatDAO dao  = new BaiHatDAO();

            try
            {
                if (file != null && file.ContentLength > 0)
                {
                    //anh bai hat
                    string fileName = Path.GetFileNameWithoutExtension(file.FileName);
                    fileName += "_" + obj.IdBaiHat;
                    fileName += Path.GetExtension(file.FileName);

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

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

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

                    file.SaveAs(path);
                    //anh nghe si
                    string fileName2 = Path.GetFileNameWithoutExtension(fileMusic.FileName);

                    //fileName2 += "_" + obj.LinkBaiHat;
                    fileName2 += Path.GetExtension(fileMusic.FileName);

                    string folderPath2 = Server.MapPath("~") + @"\MusicDowload";

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

                    string path2 = Path.Combine(folderPath2, fileName2);
                    fileMusic.SaveAs(path2);

                    obj.AnhBaiHat  = fileName;
                    obj.LinkBaiHat = fileName2;
                    obj.IdNgheSi   = Convert.ToInt32(f["getNgheSi"]);
                    int id = dao.AddNew(obj);


                    if (id != -1)
                    {
                        return(RedirectToAction("Add", "AdBaiHat"));
                    }


                    else
                    {
                        ViewBag.Message("Thêm mới không thành công!");
                        return(View());
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Bạn phải nhập vào trường này");
                }
            }
            catch
            {
            }
            TheLoaiDAO tldao    = new TheLoaiDAO();
            var        category = tldao.ListOf();
            NgheSiDAO  nsdao    = new NgheSiDAO();
            var        nghesi   = nsdao.Listof();
            AlbumDAO   abdao    = new AlbumDAO();
            var        album    = abdao.Listof();

            ViewBag.category = category;
            ViewBag.nghesi   = nghesi;
            ViewBag.album    = album;
            return(View());
        }
Example #18
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());
        }