public ActionResult Edit(int id, UserGestCor model, int roles) { if (!ModelState.IsValid) { return(View(model)); } try { model.IdRol = roles; if (model.UpdateUser(id)) { TempData["AlertMessage"] = "USUARIO EDITADO CON EXITO"; return(RedirectToAction("Index")); } else { TempData["AlertMessage"] = "Error al editar el usuario"; return(View("Error")); } } catch { return(View("Error")); } }
public ActionResult Create(UserGestCor model, int roles) { if (!ModelState.IsValid) { return(View(model)); } try { model.IdRol = roles; if (model.SaveUser()) { TempData["AlertMessage"] = "USUARIO CREADO CON EXITO"; return(RedirectToAction("Index")); } else { TempData["AlertMessage"] = "Error al crear el usuario"; return(View("Error")); } } catch { return(View("Error")); } }
public ActionResult Edit(int id) { try { UserGestCor user = new UserGestCor(); user = user.GetUsersById(id); GestCorProfile profileUser = new GestCorProfile(); List <SelectListItem> listRol = profileUser.getRolesAvaliable(user.IdRol); ViewData["roles"] = listRol; return(View(user)); } catch { return(View("Error")); } }
public ActionResult Index() { UserGestCor user = new UserGestCor(); return(View(user.GetUsers())); }