Пример #1
0
 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"));
     }
 }
Пример #2
0
 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"));
     }
 }
Пример #3
0
        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"));
            }
        }
Пример #4
0
        public ActionResult Index()
        {
            UserGestCor user = new UserGestCor();

            return(View(user.GetUsers()));
        }