Esempio n. 1
0
 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));
 }
Esempio n. 2
0
        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"));
        }
Esempio n. 3
0
        // 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));
        }
Esempio n. 4
0
        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"));
        }