public ActionResult Add(Music.Model.EF.Author author, HttpPostedFileBase IMG, string del) { author.author_bin = false; if (author.author_active != true && author.author_active != false) { author.author_active = false; } //Chèn ảnh if (IMG != null) { var code = Guid.NewGuid().ToString(); var img = new FilesController(); img.AddImages(IMG, Common.Link.IMG_AUTHOR, code); author.author_img = code + IMG.FileName; } else { author.author_img = "notImg.png"; } if (authorsDAO.Add(author)) { return(Redirect("/Admin/AuthorsAdmin")); } 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)); } }