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 Edit(Music.Model.EF.Singer singer, HttpPostedFileBase IMG, string del) { Singer sing = db.Singers.Find(singer.singer_id); singer.singer_bin = false; singer.singer_active = true; singer.singer_datecreate = sing.singer_datecreate; singer.singer_dateupdate = DateTime.Now; if (singer.singer_active != true && singer.singer_active != false) { singer.singer_active = false; } //Chèn ảnh if (IMG != null) { var code = Guid.NewGuid().ToString(); var img = new FilesController(); img.AddImages(IMG, Common.Link.IMG_SINGER, code); singer.singer_img = code + IMG.FileName; } else { singer.singer_img = sing.singer_img; } if (singersDAO.Edit(singer)) { return(Redirect("/Admin/SingersAdmin")); } else { return(Redirect(Common.Link.NOT_404)); } }