Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [HttpPost]
- [ValidateAntiForgeryToken]
- public ActionResult CrEd([Bind(Include = "IdUsuario,Nombre,Contrasena,Descripcion,Estatus,IdRol")] Usuarios usuarios, int bandera)
- {
- if(bandera == 1)
- {
- if (ModelState.IsValid)
- {
- db.Usuarios.Add(usuarios);
- db.SaveChanges();
- return RedirectToAction("Index");
- }
- ViewBag.IdRol = new SelectList(db.UsuariosRol, "IdRol", "Nombre", usuarios.IdRol);
- return View(usuarios);
- }else
- {
- if (ModelState.IsValid)
- {
- db.Entry(usuarios).State = EntityState.Modified;
- db.SaveChanges();
- return RedirectToAction("Index");
- }
- ViewBag.IdRol = new SelectList(db.UsuariosRol, "IdRol", "Nombre", usuarios.IdRol);
- return View(usuarios);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement