Example #1
0
 public ActionResult EditarLenguaje(int id, string nombre)
 {
     try
     {
         tbLenguaje tbLenguaje = _context.tbLenguaje.Find(id);
         if (tbLenguaje != null)
         {
             tbLenguaje.lenNombre             = nombre;
             tbLenguaje.lenFehcaActivacion    = DateTime.Now;
             _context.Entry(tbLenguaje).State = EntityState.Modified;
             _context.SaveChanges();
         }
         return(Json(true));
     }
     catch (Exception ex)
     {
         return(Json(false));
     }
 }
Example #2
0
 public ActionResult CrearLenguaje(string nombre)
 {
     try
     {
         if (ModelState.IsValid)
         {
             tbLenguaje tbLenguaje = new tbLenguaje();
             tbLenguaje                    = new tbLenguaje();
             tbLenguaje.lenNombre          = nombre;
             tbLenguaje.lenFehcaActivacion = DateTime.Now;
             _context.tbLenguaje.Add(tbLenguaje);
             _context.SaveChanges();
             return(Json(true));
         }
         return(Json(false));
     }
     catch (Exception ex)
     {
         return(Json(false));
     }
 }