Exemple #1
0
        public ActionResult Create(User user)
        {
            var createdUser = _iFUser.Create(UserId, user);

            _iFUserRole.Create(UserId, createdUser.UserId, user.UserRoles);
            return(RedirectToAction("Index"));
        }
Exemple #2
0
 public JsonResult AddUser(User user, List <Role> roles)
 {
     try
     {
         user = _iFUser.Create(user);
         _iFUserRole.Create(roles, user.UserId);
     }
     catch (Exception ex)
     {
         return(Json(ex.ToString()));
     }
     return(Json(string.Empty));
 }
Exemple #3
0
 public ActionResult Create(User user)
 {
     try
     {
         var createdUser = _iFUser.Create(UserId, user);
         _iFUserRole.Create(UserId, createdUser.UserId, user.UserRoles);
         if (ModelState.IsValid)
         {
             TempData["message"] = "User has been created, successfully!";
         }
         return(RedirectToAction("Create"));
     }
     catch (Exception)
     {
         if (ModelState.IsValid)
         {
             // Do your stuff
             TempData["message"] = "Opps! Something went wrong. Please, try again.";
         }
         return(RedirectToAction("Create"));
     }
 }