public virtual ActionResult Create(CreateRepositoryModel model) { JsonResultData data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { if (ModelState.IsValid) { Manager.Create(model.Name, model.Template); resultData.RedirectUrl = Url.Action("Index", new { controller = "home", repositoryName = model.Name }); } }); return Json(data); }
public virtual ActionResult Create(CreateRepositoryModel model) { JsonResultEntry resultEntry = new JsonResultEntry() { Success = true }; try { if (ModelState.IsValid) { ServiceFactory.RepositoryManager.Create(model.Name, model.Template); resultEntry.RedirectUrl = Url.Action("Index", new { controller = "home", repositoryName = model.Name }); } } catch (Exception e) { resultEntry.SetFailed().AddException(e); } resultEntry.AddModelState(ViewData.ModelState); return Json(resultEntry); }