public async Task <IActionResult> AgregarTipoCurso(TipoCurso obj) { try { //if (ModelState.IsValid) if (true) { if (obj.Id == 0) { _Db.TipoCurso.Add(obj); await _Db.SaveChangesAsync(); } else { _Db.Entry(obj).State = EntityState.Modified; await _Db.SaveChangesAsync(); } return(RedirectToAction("ListarTipoCursos")); } //return View(); } catch (Exception ex) { return(RedirectToAction("ListarTipoCursos")); } }
public async Task <IActionResult> AgregarContenido(Contenido obj) { try { if (ModelState.IsValid) { if (obj.Id == 0) { _Db.Contenido.Add(obj); await _Db.SaveChangesAsync(); } else { _Db.Entry(obj).State = EntityState.Modified; await _Db.SaveChangesAsync(); } return(RedirectToAction("ListarContenidos")); } return(View()); } catch (Exception ex) { return(RedirectToAction("ListarContenidos")); } }