示例#1
0
        public virtual ActionResult Create(CreateUserModel model, FormCollection collection)
        {
            JsonResultEntry resultEntry = new JsonResultEntry(ModelState);
            try
            {
                if (ModelState.IsValid)
                {
                    ServiceFactory.UserManager.Add(model.ToUser());
                }
            }
            catch (Exception e)
            {
                resultEntry.AddException(e);
            }

            return Json(resultEntry);
        }
示例#2
0
        public virtual ActionResult Create(CreateUserModel model, string @return)
        {
            var data = new JsonResultData(ModelState);

            if (ModelState.IsValid)
            {
                data.RunWithTry((resultData) =>
                {
                    UserManager.Add(model.ToUser());
                    data.RedirectUrl = @return;
                });
            }
            return Json(data);
        }