public ActionResult Add(Music.Model.EF.Album album, HttpPostedFileBase IMG, string del)
        {
            album.album_bin      = false;
            album.album_dateedit = DateTime.Now;

            if (album.album_active != true && album.album_active != false)
            {
                album.album_active = false;
            }

            //Chèn ảnh
            if (IMG != null)
            {
                var code = Guid.NewGuid().ToString();
                var img  = new FilesController();
                img.AddImages(IMG, Common.Link.IMG_ALBUM, code);
                album.album_img = code + IMG.FileName;
            }
            else
            {
                album.album_img = "notImg.png";
            }

            if (albumsDAO.Add(album))
            {
                return(Redirect("/Admin/AlbumsAdmin"));
            }
            else
            {
                return(Redirect(Common.Link.NOT_404));
            }
        }
Example #2
0
 public ActionResult ChangeActive(int?id)
 {
     if (id == null)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
     }
     Music.Model.EF.Album slider = db.Albums.Find(id);
     if (slider == null)
     {
         return(HttpNotFound());
     }
     db.Albums.Find(id).album_active = !db.Albums.Find(id).album_active;
     db.SaveChanges();
     return(Json(true, JsonRequestBehavior.AllowGet));
 }