public ActionResult Create(Guid gid, string name, string deploymentDirectory, string majorVersion, int revision) { var newApp = new App() { GroupKey = gid, Name = name, DeploymentDirectory = deploymentDirectory, MajorVersion = majorVersion, Revision = revision, }; if (string.IsNullOrWhiteSpace(name)) ModelState.AddModelError("name", "Name is required."); if (string.IsNullOrWhiteSpace(deploymentDirectory)) ModelState.AddModelError("deploymentDirectory", "Deployment Directory is required."); if (string.IsNullOrWhiteSpace(majorVersion)) ModelState.AddModelError("majorVersion", "Major version is required."); if (!Plywood.Utils.Validation.IsMajorVersionValid(majorVersion)) ModelState.AddModelError("majorVersion", "Major version is not valid."); if (revision < 0) ModelState.AddModelError("revision", "Revision must be a positive number."); try { if (ModelState.IsValid) { var apps = new Apps(); apps.CreateApp(newApp); return RedirectToAction("Details", new { id = newApp.Key }); } } catch (Exception ex) { ModelState.AddModelError("Error", ex); } var groups = new Groups(); var group = groups.GetGroup(gid); var model = new AppDetails() { App = newApp, Group = group, }; return View(model); }