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

            tipo_Licencias.suspencion       = true;
            tipo_Licencias.fecha_suspencion = DateTime.Now;
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Edit(Tipo_Licencias tipo_Licencias)
        {
            if (ModelState.IsValid)
            {
                Tipo_Licencias lis = db.Tipo_Licencias.Find(tipo_Licencias.id_licencia);
                lis.nombre_licencia = tipo_Licencias.nombre_licencia;
                await db.SaveChangesAsync();

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

            if (tipo_Licencias == null)
            {
                return(HttpNotFound());
            }
            return(View(tipo_Licencias));
        }
Ejemplo n.º 4
0
        public async Task <ActionResult> Create(Tipo_Licencias tipo_Licencias)
        {
            if (ModelState.IsValid)
            {
                Tipo_Licencias tip = await db.Tipo_Licencias.Where(x => x.id_licencia == tipo_Licencias.id_licencia).FirstOrDefaultAsync();

                if (tip == null)
                {
                    db.Tipo_Licencias.Add(tipo_Licencias);
                    await db.SaveChangesAsync();
                }
                return(RedirectToAction("Index"));
            }

            return(View(tipo_Licencias));
        }