Skip to content

Commit

Permalink
Fixes #4 Script Name Must Be Unique
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelburns committed Nov 28, 2015
1 parent ce191f4 commit 06c8a4d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/LaunchPad/Controllers/PowerShellController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ public IActionResult Create()
[HttpPost] //TODO: Need to turn off ValidateInput
[ValidateAntiForgeryToken]
public ActionResult Create([Bind("Name,Script")] PowerShellViewModel newScript)
{
var script = ConvertServices.CreateScript(newScript, User.Identity.Name);

{
if (ScriptIO.ScriptExists(newScript.Name)) //TODO: Ensure this works on ViewModel - Having Issues - 11/16/2015
{
ModelState.AddModelError("Name", "This Name Already Exists");
return View(newScript);
}
var script = ConvertServices.CreateScript(newScript, User.Identity.Name);
if (TryValidateModel(script))
{
//Write File and Save Metadata
Expand Down
1 change: 0 additions & 1 deletion src/LaunchPad/Views/PowerShell/Create.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
@Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
<span asp-validation-for="Name"></span>
</div>
</div>
Expand Down

0 comments on commit 06c8a4d

Please sign in to comment.