public ActionResult DeleteConfirmed(int id) { t_dokumentasi t_dokumentasi = db.t_dokumentasi.Find(id); db.t_dokumentasi.Remove(t_dokumentasi); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Details(int id = 0) { t_dokumentasi t_dokumentasi = db.t_dokumentasi.Find(id); if (t_dokumentasi == null) { return(HttpNotFound()); } return(View(t_dokumentasi)); }
public ActionResult Edit(int id, admin.Models.FotoCreate dokumentasi) { if (ModelState.IsValid) { using (var db = new db_esosEntities()) { t_dokumentasi t_dokumentasi = db.t_dokumentasi.Find(id); t_dokumentasi.album_id = dokumentasi.album_id; t_dokumentasi.dokumentasi_date = DateTime.Now; t_dokumentasi.dokumentasi_title = dokumentasi.dokumentasi_title; if (dokumentasi.dokumentasi_path != null) { if (dokumentasi.dokumentasi_path.ContentLength < 102400000) { var fileName = Path.GetFileName(dokumentasi.dokumentasi_path.FileName); var ex = Path.GetExtension(fileName); if (ex == ".mp4") { var path = Path.Combine(Server.MapPath("~/Content/Video"), fileName); dokumentasi.dokumentasi_path.SaveAs(path); t_dokumentasi.dokumentasi_path = "~/Content/Video/" + fileName; } else { ModelState.AddModelError("", "Video harus berformat (MP4)"); ViewBag.album_id = new SelectList(db.t_album.ToList(), "album_id", "album_title"); return(View(dokumentasi)); } } else { ModelState.AddModelError("", "Ukuran video tidak boleh lebih dari 100 MB"); ViewBag.album_id = new SelectList(db.t_album.ToList(), "album_id", "album_title"); return(View(dokumentasi)); } } db.SaveChanges(); return(RedirectToAction("Index")); } } else { ViewBag.album_id = new SelectList(db.t_album.ToList(), "album_id", "album_title"); return(View(dokumentasi)); } }