diff --git a/Pages/Edit.cshtml.cs b/Pages/Edit.cshtml.cs
index f016a2a..bde0738 100644
--- a/Pages/Edit.cshtml.cs
+++ b/Pages/Edit.cshtml.cs
@@ -9,6 +9,8 @@ public class EditModel : PageModel {
public void OnGet() { }
public async void OnPost() {
+ Response.Redirect("/");
+
await using var db = new DatabaseContext();
var bot = db.Bots.First(p => p.Id == int.Parse(Request.RouteValues["id"]!.ToString()!));
@@ -30,7 +32,5 @@ public class EditModel : PageModel {
await db.SaveChangesAsync();
Task.WhenAny(Task.Run(() => BotOrchestrator.AddBot(bot)), Task.Delay(500)).Wait();
}
-
- Response.Redirect("/");
}
}
diff --git a/Pages/Index.cshtml.cs b/Pages/Index.cshtml.cs
index e4c5b9a..0572784 100644
--- a/Pages/Index.cshtml.cs
+++ b/Pages/Index.cshtml.cs
@@ -8,6 +8,8 @@ public class IndexModel : PageModel {
public void OnGet() { }
public async void OnPost() {
+ Response.Redirect("/");
+
await using var db = new DatabaseContext();
if (Request.Form["action"] == "add_bot") {
var bot = new Backend.Database.Tables.Bot {
@@ -21,17 +23,12 @@ public class IndexModel : PageModel {
db.Add(bot);
await db.SaveChangesAsync();
await Task.WhenAny(Task.Run(() => BotOrchestrator.AddBot(bot)), Task.Delay(500));
- Response.Redirect("/");
}
else if (Request.Form["action"] == "delete_bot") {
var bot = await db.Bots.FindAsync(int.Parse(Request.Form["bot_id"]!));
BotOrchestrator.DelBot(bot!);
db.Remove(bot!);
await db.SaveChangesAsync();
- Response.Redirect("/");
- }
- else {
- Response.Redirect("/");
}
}
}