예제 #1
0
        //Hàm xoá
        public JsonResult DeleteCate(int?id)
        {
            var dao = new CategoriesDAO();
            var j   = new JsonAdminController();

            if (dao.Delete(id))
            {
                List <Category>    categories = db.Categories.Where(n => n.category_bin == true).OrderByDescending(n => n.category_datecreate).ToList();
                List <jCategories> list       = categories.Select(n => new jCategories
                {
                    category_active     = n.category_active,
                    category_bin        = n.category_bin,
                    category_datecreate = n.category_datecreate.Value.ToString("dd/MM/yyyy"),
                    category_dateupdate = n.category_dateupdate.Value.ToString("dd/MM/yyyy"),
                    category_id         = n.category_id,
                    category_img        = n.category_img,
                    category_name       = n.category_name,
                    category_note       = n.category_note,
                    category_view       = n.category_view,
                }).ToList();
                return(Json(list, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(null));
            }
        }
        //Hàm xoá
        public JsonResult DeleteAl(int?id)
        {
            var dao = new AlbumsDAO();
            var j   = new JsonAdminController();

            if (dao.Delete(id))
            {
                List <Album>   albums = db.Albums.Where(n => n.album_bin == false).OrderBy(n => n.album_name).ToList();
                List <jAlbums> list   = albums.Select(n => new jAlbums
                {
                    album_active     = n.album_active,
                    album_bin        = n.album_bin,
                    album_datecreate = n.album_datecreate.Value.ToString("dd/MM/yyyy"),
                    album_dateedit   = n.album_dateedit.Value.ToString("dd/MM/yyyy"),
                    album_favorite   = n.album_favorite,
                    album_id         = n.album_id,
                    album_img        = n.album_img,
                    album_name       = n.album_name,
                    album_note       = n.album_note,
                    album_view       = n.album_view,
                    user_id          = n.user_id
                }).ToList();
                return(Json(list, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(null));
            }
        }
        //Hàm xoá
        public JsonResult Deleteau(int?id)
        {
            var dao = new AuthorsDAO();
            var j   = new JsonAdminController();

            if (dao.Delete(id))
            {
                List <Author>   authors = db.Authors.Where(n => n.author_bin == true).OrderBy(n => n.author_name).ToList();
                List <jAuthors> list    = authors.Select(n => new jAuthors
                {
                    author_active     = n.author_active,
                    author_bin        = n.author_bin,
                    author_datecreate = n.author_datecreate.Value.ToString("dd/MM/yyyy"),
                    author_dateupdate = n.author_dateupdate.Value.ToString("dd/MM/yyyy"),
                    author_id         = n.author_id,
                    author_img        = n.author_img,
                    author_name       = n.author_name,
                    author_note       = n.author_note
                }).ToList();
                return(Json(list, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(null));
            }
        }
예제 #4
0
        //Hàm xoá
        public JsonResult DeleteNation(int?id)
        {
            var dao = new NationsDAO();
            var j   = new JsonAdminController();

            if (dao.Delete(id))
            {
                List <National> nationals = db.Nationals.Where(n => n.nation_bin == true).OrderBy(n => n.nation_name).ToList();
                List <jNations> list      = nationals.Select(n => new jNations
                {
                    nation_active     = n.nation_active,
                    nation_bin        = n.nation_bin,
                    nation_datecreate = n.nation_datecreate.Value.ToString("dd/MM/yyyy"),
                    nation_dateupdate = n.nation_dateupdate.Value.ToString("dd/MM/yyyy"),
                    nation_id         = n.nation_id,
                    nation_name       = n.nation_name,
                    nation_option     = n.nation_option
                }).ToList();
                return(Json(list, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(null));
            }
        }
        //Hàm Xoá
        public JsonResult Deletesing(int?id)
        {
            var dao = new SingersDAO();
            var j   = new JsonAdminController();

            if (dao.Delete(id))
            {
                List <Singer>   singers = db.Singers.Where(n => n.singer_bin == true).OrderBy(n => n.singer_name).ToList();
                List <jSingers> list    = singers.Select(n => new jSingers
                {
                    singer_active     = n.singer_active,
                    singer_bin        = n.singer_bin,
                    singer_id         = n.singer_id,
                    singer_img        = n.singer_img,
                    singer_name       = n.singer_name,
                    singer_note       = n.singer_note,
                    singer_datecreate = n.singer_datecreate.Value.ToString("dd/MM/yyyy"),
                    singer_dateupdate = n.singer_dateupdate.Value.ToString("dd/MM/yyyy"),
                }).ToList();
                return(Json(list, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(null));
            }
        }
        //Hàm xoá
        public JsonResult DeleteUser(int?id)
        {
            var dao = new UsersDAO();
            var j   = new JsonAdminController();

            if (dao.Delete(id))
            {
                List <User>   users = db.Users.Where(n => n.user_bin == true).OrderBy(n => n.user_name).ToList();
                List <jUsers> list  = users.Select(n => new jUsers
                {
                    user_active     = n.user_active,
                    user_bin        = n.user_bin,
                    user_code       = n.user_code,
                    user_datecreate = n.user_datecreate.ToString(),
                    user_datelogin  = n.user_datelogin.ToString(),
                    user_deadline   = n.user_deadline.ToString(),
                    user_email      = n.user_email,
                    user_id         = n.user_id,
                    user_img        = n.user_img,
                    user_name       = n.user_name,
                    user_option     = n.user_option,
                    user_pass       = n.user_pass,
                    user_point      = n.user_point,
                    user_token      = n.user_token,
                    user_address    = n.user_address,
                    user_birth      = n.user_birth.ToString(),
                    user_datevip    = n.user_datevip.ToString(),
                    user_note       = n.user_note,
                    user_phone      = n.user_phone,
                    user_vip        = n.user_vip,
                    role_id         = n.role_id,
                    role_name       = n.Role.role_name,
                }).ToList();
                return(Json(list, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(null));
            }
        }