Till slut fick jag personvalet att fungera
This commit is contained in:
@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user