diff --git a/BantFlags/Data/Staging.cs b/BantFlags/Data/Staging.cs index 407de98..4fae4cb 100644 --- a/BantFlags/Data/Staging.cs +++ b/BantFlags/Data/Staging.cs @@ -29,11 +29,11 @@ namespace BantFlags.Data public enum Method { - Delete, + Add = 0, - Rename, + Delete = 1, - Add + Rename = 2 } public class Flag diff --git a/BantFlags/Pages/Upload.cshtml b/BantFlags/Pages/Upload.cshtml index 96e52d0..5efecda 100644 --- a/BantFlags/Pages/Upload.cshtml +++ b/BantFlags/Pages/Upload.cshtml @@ -51,7 +51,6 @@

Deleted Flags

- @* 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 @@ - + } @@ -77,7 +76,7 @@ - + } @@ -93,7 +92,7 @@ - + } diff --git a/BantFlags/Pages/Upload.cshtml.cs b/BantFlags/Pages/Upload.cshtml.cs index ca87ff9..a806aff 100644 --- a/BantFlags/Pages/Upload.cshtml.cs +++ b/BantFlags/Pages/Upload.cshtml.cs @@ -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;