Exemple #1
0
        public ActionResult Create(CreateUserModel model)
        {
            try {
                if (ModelState.IsValid)
                {
                    User user = new User();
                    ModelCopier.CopyModel(model, user);
                    _repository.CreateNewUser(user);

                    return(RedirectToAction("Details", new { id = user.UserName }));
                }
            } catch (Exception) {
                ModelState.AddModelError("", "Create Failure, try another user name or" +
                                         " see inner exception.");
            }

            return(View("Create", model));
        }