Ejemplo n.º 1
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            juzgado juzgado = await db.juzgado.FindAsync(id);

            db.juzgado.Remove(juzgado);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Edit([Bind(Include = "id,nombre,lugar,piso,ciudad,nombre_juez,apellido_juez,descripcion,tipoId")] juzgado juzgado)
        {
            if (ModelState.IsValid)
            {
                db.Entry(juzgado).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            LlenarTipoJuzgadoDropDownList(juzgado.tipoId);
            return(View(juzgado));
        }
Ejemplo n.º 3
0
        // GET: juzgados/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            juzgado juzgado = await db.juzgado.FindAsync(id);

            if (juzgado == null)
            {
                return(HttpNotFound());
            }
            return(View(juzgado));
        }
Ejemplo n.º 4
0
        // GET: juzgados/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            juzgado juzgado = await db.juzgado.FindAsync(id);

            if (juzgado == null)
            {
                return(HttpNotFound());
            }
            LlenarTipoJuzgadoDropDownList(juzgado.tipoId);
            return(View(juzgado));
        }
Ejemplo n.º 5
0
        public async Task <ActionResult> Create([Bind(Include = "id,nombre,lugar,piso,ciudad,nombre_juez,apellido_juez,descripcion,tipoId")] juzgado juzgado)
        {
            try {
                if (ModelState.IsValid)
                {
                    db.juzgado.Add(juzgado);
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
            }
            catch (RetryLimitExceededException)
            {
                ModelState.AddModelError("", "No se pudo grabar los cambios. Trate de nuevo, y si persiste el problema comunicarse con el administrador.");
            }

            LlenarTipoJuzgadoDropDownList(juzgado.tipoId);
            return(View(juzgado));
        }