Home > Net >  Successfully registered user message in the View before inserting it into the database ASP MVC
Successfully registered user message in the View before inserting it into the database ASP MVC

Time:02-10

I have this user registration Action in my Controller but I would like the View to show a message like: "User successfully registered" before proceeding to login. What would be the best way to implement it? I'd appreciate your help

// REGISTRO USUARIO
public ActionResult RegistroUsuario()
{
    return View();
}

// REGISTRO USUARIO [POST]
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult RegistroUsuario([Bind(Include = "IDUSUARIO,TIPO,NOMBRE,APELLIDO,DNI,EMAIL,USUARIO,CLAVE,SEXO,FECHANAC, DISTRITO")] TB_Usuarios tB_Usuarios)
{
    if (ModelState.IsValid)
    {
        db.TB_Usuarios.Add(tB_Usuarios);
        db.SaveChanges();
        return RedirectToAction("Login", "Login");
    }

    return View(tB_Usuarios);
}

CodePudding user response:

  •  Tags:  
  • Related