public ActionResult AddAlerta(Alerta obj) { if (!this.currentUser()) { return(RedirectToAction("Ingresar", "Login")); } try { if (ModelState.IsValid) { if (obj.IdAlerta == 0) { if (dal.AddAlerta(obj) > 0) { return(RedirectToAction("Index")); } } else { if (dal.UpdateAlerta(obj)) { return(RedirectToAction("Index")); } } } } catch (Exception ex) { throw; } TempData["Alerta"] = obj; return(RedirectToAction("Index")); }