public ActionResult Edit([Bind(Include = "PodcastBaseID,dsTitulo,dsPodcast,dtGravacao,nrEdicao,nmArquivoAudio,nmArquivoImagem")] PodcastBase podcastBase) { if (ModelState.IsValid) { db.Entry(podcastBase).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(podcastBase)); }
public ActionResult DeleteConfirmed(int id) { PodcastBase podcastBase = db.Podcasts.Find(id); db.Podcasts.Remove(podcastBase); db.SaveChanges(); DeleteArquivo("/media/audio/" + podcastBase.nmArquivoAudio); DeleteArquivo("/media/image/" + podcastBase.nmArquivoImagem); return(RedirectToAction("Index")); }
// GET: Podcast/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PodcastBase podcastBase = db.Podcasts.Find(id); if (podcastBase == null) { return(HttpNotFound()); } return(View(podcastBase)); }
public ActionResult Create(PodcastBase podcastBase) { if ((ModelState.IsValid) && (podcastBase.dsTitulo != "")) { if (podcastBase.PodcastBaseID == 0) { db.Podcasts.Add(podcastBase); } else { db.Entry(podcastBase).State = EntityState.Modified; } db.SaveChanges(); } else { throw new FormatException("Informações inválidas"); } return(RedirectToAction("Index")); }