// GET: Concursos/Edit/5
        public ActionResult Edit(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Concursos concursos = db.Concursos.Find(id);

            if (concursos == null)
            {
                return(HttpNotFound());
            }
            //ViewBag.ChaveFK = new SelectList(db.Chaves, "ID", "Numeros", concursos.ChaveFK);

            ViewBag.ChaveFK = new SelectList(
                from s in db.Chaves
                select new {
                s.ID,
                Chave = s.Numeros + " + " + s.Estrelas
            },
                "ID",
                "Chave",
                concursos.ChaveFK);
            return(View(concursos));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Concursos concursos = db.Concursos.Find(id);

            db.Concursos.Remove(concursos);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ID,DataConcurso,ChaveFK")] Concursos concursos)
 {
     if (ModelState.IsValid)
     {
         db.Entry(concursos).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ChaveFK = new SelectList(db.Chaves, "ID", "Numeros", concursos.ChaveFK);
     return(View(concursos));
 }
        public ActionResult Create([Bind(Include = "ID,DataConcurso,ChaveFK")] Concursos concursos)
        {
            if (ModelState.IsValid)
            {
                db.Concursos.Add(concursos);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ChaveFK = new SelectList(db.Chaves, "ID", "Numeros", concursos.ChaveFK);
            return(View(concursos));
        }
        // GET: Concursos/Details/5
        public ActionResult Details(int id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index"));
            }
            Concursos concursos = db.Concursos.Find(id);

            if (concursos == null)
            {
                return(HttpNotFound());
            }
            return(View(concursos));
        }
        // GET: Concursos/Delete/5
        public ActionResult Delete(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Concursos concursos = db.Concursos.Find(id);

            if (concursos == null)
            {
                return(HttpNotFound());
            }
            return(View(concursos));
        }
示例#7
0
        // GET: Concursos/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Concursos concursos = db.Concursos.Find(id);

            if (concursos == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ChaveFK = new SelectList(db.Chaves, "ID", "ID", concursos.ChaveFK);
            return(View(concursos));
        }