There were some bugs.

dotnetflags
C-xC-c 5 years ago
parent dc88b5ccf1
commit f3bc243690

@ -29,11 +29,11 @@ namespace BantFlags.Data
public enum Method
{
Delete,
Add = 0,
Rename,
Delete = 1,
Add
Rename = 2
}
public class Flag

@ -51,7 +51,6 @@
<br />
<button type="submit">Remove from staging</button>
<h3>Deleted Flags</h3>
@* TODO: There has to be a better way to handle this*@
@for (int i = 0; i < Model.StagedFlags.Flags.Count(); i++)
{
if (Model.StagedFlags.Flags[i].FlagMethod == Method.Delete)
@ -61,7 +60,7 @@
<label>@(Model.StagedFlags.Flags[i].Name)</label>
<img src="~/flags/@(Model.StagedFlags.Flags[i].Name).png" />
<input type="hidden" name="flags[@i].Name" value="@Model.StagedFlags.Flags[i].Name" />
<input type="hidden" name="flags[@i].FormMethod" value="@Model.StagedFlags.Flags[i].FlagMethod" />
<input type="hidden" name="flags[@i].FlagMethod" value="@Model.StagedFlags.Flags[i].FlagMethod" />
<input type="checkbox" name="flags[@i].IsChecked" value="true" />
</div>
}
@ -77,7 +76,7 @@
<label>@(Model.StagedFlags.Flags[i].Name)</label>
<img src="~/flags/@(Model.StagedFlags.Flags[i].OldName).png" />
<input type="hidden" name="flags[@i].Name" value="@Model.StagedFlags.Flags[i].Name" />
<input type="hidden" name="flags[@i].FormMethod" value="@Model.StagedFlags.Flags[i].FlagMethod" />
<input type="hidden" name="flags[@i].FlagMethod" value="@Model.StagedFlags.Flags[i].FlagMethod" />
<input type="checkbox" name="flags[@i].IsChecked" value="true" />
</div>
}
@ -93,7 +92,7 @@
<label>@(Model.StagedFlags.Flags[i].Name)</label>
<img src="~/flags/staging/@(Model.StagedFlags.Flags[i].Name).png" />
<input type="hidden" name="flags[@i].Name" value="@Model.StagedFlags.Flags[i].Name" />
<input type="hidden" name="flags[@i].FormMethod" value="@Model.StagedFlags.Flags[i].FlagMethod" />
<input type="hidden" name="flags[@i].FlagMethod" value="@Model.StagedFlags.Flags[i].FlagMethod" />
<input type="checkbox" name="flags[@i].IsChecked" value="true" />
</div>
}

@ -60,6 +60,7 @@ namespace BantFlags
StagedFlags.Flags.Add(stagingFlag.Value);
StagedFlags.Names.Remove(stagingFlag.Value.OldName);
StagedFlags.Names.Add(stagingFlag.Value.Name);
Message = $"{stagingFlag.Value.OldName} renamed to {stagingFlag.Value.Name}.";
return Page();
@ -130,6 +131,7 @@ namespace BantFlags
break;
case Method.Rename:
StagedFlags.Names.Remove(flag.Name);
StagedFlags.Names.Add(flag.OldName);
break;
@ -163,6 +165,10 @@ namespace BantFlags
case Method.Delete:
await Database.DeleteFlagAsync(flag);
if (System.IO.File.Exists(WebRoot + "/flags/dead/" + flagname))
{
System.IO.File.Delete(WebRoot + "/flags/dead/" + flagname);
}
Directory.Move(WebRoot + "/flags/" + flagname, WebRoot + "/flags/dead/" + flagname);
break;

Loading…
Cancel
Save