Example #1
0
        // GET: tarefas/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tarefa tarefa = db.Tarefas.Find(id);

            if (tarefa == null)
            {
                return(HttpNotFound());
            }
            return(View(tarefa));
        }
        // GET: tarefas/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tarefa tarefa = db.tarefa.Find(id);

            if (tarefa == null)
            {
                return(HttpNotFound());
            }
            ViewBag.projetos_id = new SelectList(db.projeto, "id", "nome", tarefa.projetos_id);
            return(View(tarefa));
        }
Example #3
0
        //[ValidateAntiForgeryToken]
        public ActionResult Create([Bind(Include = "idtarefa,titulo,descricao")] tarefa tarefa)
        {
            //System.Date dataBancoMysql = Convert.ToDateTime(dataEntrega.ToString()).ToString("yyyy/MM/dd");
            //tarefa.dataEntrega.ToUniversalTime();
            ViewBag.idSala     = TempData["IDSALA"];
            TempData["IDSALA"] = ViewBag.idSala;
            sala k = db.sala.ToList().Find(s => s.idsala == ViewBag.idSala);

            tarefa.sala_idsala = k.idsala;
            tarefa.sala_temasala_idtemasala = k.temasala_idtemasala;
            tarefa.entregue = false;
            //tarefa.dataEntrega = dataBancoMysql.ToString();
            if (ModelState.IsValid)
            {
                db.tarefa.Add(tarefa);
                db.SaveChanges();
                return(RedirectToAction("Index", "Home"));
            }

            return(View(tarefa));
        }