public ActionResult Edit(MusicsList musics, HttpPostedFileBase IMG, HttpPostedFileBase MP3) { MusicsList mus = db.MusicsLists.Find(musics.music_id); musics.music_active = mus.music_active; musics.music_datecreate = mus.music_datecreate; musics.music_dateedit = DateTime.Now; musics.music_bin = mus.music_bin; musics.music_option = mus.music_option; musics.music_view = mus.music_view; musics.music_love = mus.music_love; musics.user_id = mus.user_id; musics.music_dowload = mus.music_dowload; var i = new ImagesController(); if (IMG != null) { var code = Guid.NewGuid().ToString(); var img = new ImagesController(); img.AddImages(IMG, Common.Link.IMG_MUSIC, code); musics.music_img = code + IMG.FileName; } else { musics.music_img = mus.music_img; } //Nhạc if (MP3 != null) { var code = Guid.NewGuid().ToString(); var mp3 = new ImagesController(); mp3.AddMP3(MP3, Common.Link.MP3_MUSIC, code); musics.music_linkdow = code + MP3.FileName; } else { musics.music_linkdow = mus.music_linkdow; } var dao = new MusicsDAO(); if (dao.Edit(musics)) { return(Redirect("/Admin/MusicsListAdmin")); } else { return(Redirect(Common.Link.NOT_404)); } }
public ActionResult Edit(Users users, HttpPostedFileBase IMG) { if (ModelState.IsValid) { ImagesController images = new ImagesController(); images.AddImages(IMG, "Users", Guid.NewGuid().ToString()); usersDAO.Edit(users); return(RedirectToAction("Info")); } return(View(users)); }
public ActionResult Add(MusicsList musics, HttpPostedFileBase IMG, HttpPostedFileBase MP3, string del) { //Cập nhật có thay đổi musics.music_option = true; musics.music_bin = false; //Kiem tra thay đổi value if (musics.music_active != true && musics.music_active != false) { musics.music_active = false; } //Hinh ảnh if (IMG != null) { var code = Guid.NewGuid().ToString(); var img = new ImagesController(); img.AddImages(IMG, Common.Link.IMG_MUSIC, code); musics.music_img = code + IMG.FileName; } else { musics.music_img = "notImg.png"; } //Nhạc if (MP3 != null) { var code = Guid.NewGuid().ToString(); var mp3 = new ImagesController(); mp3.AddMP3(MP3, Common.Link.MP3_MUSIC, code); musics.music_linkdow = code + MP3.FileName; } else { musics.music_linkdow = "NULL"; } var dao = new MusicsDAO(); var j = new JsonAdminController(); if (dao.Add(musics)) { return(Redirect("/Admin/MusicsListAdmin")); } else { return(Redirect(Common.Link.NOT_404)); } }
public ActionResult Edit(Singer singer, HttpPostedFileBase IMG) { Singer sing = db.Singers.Find(singer.singer_id); singer.singer_active = sing.singer_active; singer.singer_bin = sing.singer_bin; singer.singer_datecreate = sing.singer_datecreate; singer.singer_dateupdate = DateTime.Now; singer.singer_name = sing.singer_name; singer.singer_note = sing.singer_note; singer.singer_option = sing.singer_option; singer.user_id = sing.user_id; var i = new ImagesController(); if (IMG != null) { var code = Guid.NewGuid().ToString(); var img = new ImagesController(); img.AddImages(IMG, Common.Link.IMG_SINGER, code); singer.singer_img = code + IMG.FileName; } else { singer.singer_img = sing.singer_img; } var dao = new SingersDAO(); if (dao.Edit(singer)) { return(Redirect("/Admin/SingersAdmin")); } else { return(Redirect(Common.Link.NOT_404)); } }
public ActionResult Add(Author author, HttpPostedFileBase IMG, string del) { //Cập nhật có thay đổi author.author_option = true; author.author_bin = false; //Kiem tra thay đổi value if (author.author_active != true && author.author_active != false) { author.author_active = false; } //Hinh ảnh if (IMG != null) { var code = Guid.NewGuid().ToString(); var img = new ImagesController(); img.AddImages(IMG, Common.Link.IMG_AUTHOR, code); author.author_img = code + IMG.FileName; } else { author.author_img = "notImg.png"; } var dao = new AuthorsDAO(); var j = new JsonAdminController(); if (dao.Add(author)) { return(Redirect("/Admin/AuthorsAdmin")); } else { return(Redirect(Common.Link.NOT_404)); } }
public ActionResult Add(Category category, HttpPostedFileBase IMG, string del) { //Cập nhật có thay đổi category.category_option = true; category.category_bin = false; //Kiem tra thay đổi value if (category.category_active != true && category.category_active != false) { category.category_active = false; } //Hinh ảnh if (IMG != null) { var code = Guid.NewGuid().ToString(); var img = new ImagesController(); img.AddImages(IMG, Common.Link.IMG_CATEGORY, code); category.category_img = code + IMG.FileName; } else { category.category_img = "notImg.png"; } var dao = new CategoriesDAO(); var j = new JsonAdminController(); if (dao.ADD(category)) { return(Redirect("/Admin/CategoriesAdmin")); } else { return(Redirect(Common.Link.NOT_404)); } }
public ActionResult Edit(Category category, HttpPostedFileBase IMG) { Category cate = db.Categories.Find(category.category_id); category.category_active = cate.category_active; category.category_datecreate = cate.category_datecreate; category.category_dateupdate = DateTime.Now; category.category_bin = cate.category_bin; category.category_option = cate.category_option; category.category_view = cate.category_view; category.user_id = cate.user_id; var i = new ImagesController(); if (IMG != null) { var code = Guid.NewGuid().ToString(); var img = new ImagesController(); img.AddImages(IMG, Common.Link.IMG_CATEGORY, code); category.category_img = code + IMG.FileName; } else { category.category_img = cate.category_img; } var dao = new CategoriesDAO(); if (dao.Edit(category)) { return(Redirect("/Admin/CategoriesAdmin")); } else { return(Redirect(Common.Link.NOT_404)); } }
public ActionResult Edit(User user, HttpPostedFileBase IMG) { User us = db.Users.Find(user.user_id); user.user_active = us.user_active; user.user_datecreate = us.user_datecreate; user.user_datelogin = DateTime.Now; user.user_bin = us.user_bin; user.user_option = us.user_option; user.user_code = us.user_code; user.user_token = us.user_token; var i = new ImagesController(); if (IMG != null) { var code = Guid.NewGuid().ToString(); var img = new ImagesController(); img.AddImages(IMG, Common.Link.IMG_USER, code); user.user_img = code + IMG.FileName; } else { user.user_img = us.user_img; } var dao = new UsersDAO(); if (dao.Edit(user)) { return(Redirect("/Admin/UsersAdmin")); } else { return(Redirect(Common.Link.NOT_404)); } }
public ActionResult Edit(Author author, HttpPostedFileBase IMG) { Author au = db.Authors.Find(author.author_id); author.author_active = au.author_active; author.author_datecreate = au.author_datecreate; author.author_dateupdate = DateTime.Now; author.author_bin = au.author_bin; author.author_option = au.author_option; author.user_id = au.user_id; var i = new ImagesController(); if (IMG != null) { var code = Guid.NewGuid().ToString(); var img = new ImagesController(); img.AddImages(IMG, Common.Link.IMG_AUTHOR, code); author.author_img = code + IMG.FileName; } else { author.author_img = au.author_img; } var dao = new AuthorsDAO(); if (dao.Edit(author)) { return(Redirect("/Admin/authorsAdmin")); } else { return(Redirect(Common.Link.NOT_404)); } }
public ActionResult Edit(Album album, HttpPostedFileBase IMG) { Album al = db.Albums.Find(album.album_id); album.album_active = al.album_active; album.album_datecreate = al.album_datecreate; album.album_dateedit = DateTime.Now; album.album_bin = al.album_bin; album.album_option = al.album_option; album.user_id = al.user_id; var i = new ImagesController(); if (IMG != null) { var code = Guid.NewGuid().ToString(); var img = new ImagesController(); img.AddImages(IMG, Common.Link.IMG_ALBUM, code); album.album_img = code + IMG.FileName; } else { album.album_img = al.album_img; } var dao = new AlbumsDAO(); if (dao.Edit(album)) { return(Redirect("/Admin/AlbumsAdmin")); } else { return(Redirect(Common.Link.NOT_404)); } }