This commit is contained in:
2026-06-18 21:07:28 -04:00
parent eefbb62eb7
commit 50dcc8e55c
29 changed files with 502 additions and 179 deletions
+4 -12
View File
@@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Chrono.Model;
using Microsoft.AspNetCore.Mvc;
namespace Server.Controllers;
@@ -21,10 +20,7 @@ public class NotesController : ControllerBase
try
{
var note = await _context.CardNotes.FindAsync(cardName);
if (note == null)
{
return Ok(new CardNote { CardName = cardName, Note = "" });
}
if (note == null) return Ok(new CardNote { CardName = cardName, Note = "" });
return Ok(note);
}
catch (Exception ex)
@@ -41,13 +37,9 @@ public class NotesController : ControllerBase
{
var existing = await _context.CardNotes.FindAsync(note.CardName);
if (existing == null)
{
_context.CardNotes.Add(note);
}
else
{
existing.Note = note.Note;
}
await _context.SaveChangesAsync();
}
@@ -55,7 +47,7 @@ public class NotesController : ControllerBase
{
Console.WriteLine($"[WARNING] Could not save note to database: {ex.Message}");
}
return Ok(note);
}
}
}