From e0ebed7c094611f8827527a9639cf5c2fa9f7316 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 6 Aug 2025 02:23:22 +0800 Subject: [PATCH] :bug: Fix poll controller agian... --- DysonNetwork.Sphere/Poll/PollController.cs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/DysonNetwork.Sphere/Poll/PollController.cs b/DysonNetwork.Sphere/Poll/PollController.cs index bd5b042..bace2a7 100644 --- a/DysonNetwork.Sphere/Poll/PollController.cs +++ b/DysonNetwork.Sphere/Poll/PollController.cs @@ -175,9 +175,6 @@ public class PollController(AppDatabase db, PollService polls, PublisherService if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var accountId = Guid.Parse(currentUser.Id); - // Start a transaction - await using var transaction = await db.Database.BeginTransactionAsync(); - try { var poll = await db.Polls @@ -206,16 +203,13 @@ public class PollController(AppDatabase db, PollService polls, PublisherService polls.ValidatePoll(poll); + db.Update(poll); await db.SaveChangesAsync(); - // Commit the transaction if all operations succeed - await transaction.CommitAsync(); - return Ok(poll); } catch (Exception ex) { - await transaction.RollbackAsync(); return BadRequest(ex.Message); } }