Till slut fick jag personvalet att fungera

This commit is contained in:
2025-09-06 11:59:04 +02:00
parent d3c9dcb208
commit a2d47debfe
11 changed files with 223 additions and 46 deletions

View File

@ -22,9 +22,9 @@ public class ParticipantRepository : IRepository<Participant>
// Fix: Use FindAsync with key value array, not a predicate
return await _dataContext.Participants.FindAsync(id);
}
public async Task<bool> Save(Participant entity)
public async Task<int> Save(Participant entity)
{
var res = false;
var res = -1;
if (string.IsNullOrEmpty(entity.FirstName)
|| string.IsNullOrEmpty(entity.LastName))
{
@ -35,13 +35,13 @@ public class ParticipantRepository : IRepository<Participant>
{
_dataContext.Participants.Add(entity);
await _dataContext.SaveChangesAsync();
res = true;
res = entity.ParticipantId;
}
else
{
_dataContext.Participants.Update(entity);
await _dataContext.SaveChangesAsync();
res = true;
res = entity.ParticipantId;
}
return res;