Till slut fick jag personvalet att fungera
This commit is contained in:
@ -21,9 +21,9 @@ public class GamePointRepository : IRepository<GamePoint>
|
||||
{
|
||||
return await _dataContext.GamePoints.FindAsync(id);
|
||||
}
|
||||
public async Task<bool> Save(GamePoint entity)
|
||||
public async Task<int> Save(GamePoint entity)
|
||||
{
|
||||
var res = false;
|
||||
var res = -1;
|
||||
if ((entity.GameRoundRegNr == 0)
|
||||
|| (entity.GameRegPoints == 0))
|
||||
{
|
||||
@ -34,13 +34,13 @@ public class GamePointRepository : IRepository<GamePoint>
|
||||
{
|
||||
_dataContext.GamePoints.Add(entity);
|
||||
await _dataContext.SaveChangesAsync();
|
||||
res = true;
|
||||
res = entity.GamePointId;
|
||||
}
|
||||
else
|
||||
{
|
||||
_dataContext.GamePoints.Update(entity);
|
||||
await _dataContext.SaveChangesAsync();
|
||||
res = true;
|
||||
res = entity.GamePointId;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -41,20 +41,20 @@ public class GameRoundRepository : IRepository<GameRound>
|
||||
return await _dataContext.GameRounds.FindAsync(id);
|
||||
}
|
||||
|
||||
public async Task<bool> Save(GameRound entity)
|
||||
public async Task<int> Save(GameRound entity)
|
||||
{
|
||||
var res = false;
|
||||
var res = -1;
|
||||
if (entity.GameRoundId == 0)
|
||||
{
|
||||
_dataContext.GameRounds.Add(entity);
|
||||
await _dataContext.SaveChangesAsync();
|
||||
res = true;
|
||||
res = entity.GameRoundId;
|
||||
}
|
||||
else
|
||||
{
|
||||
_dataContext.GameRounds.Update(entity);
|
||||
await _dataContext.SaveChangesAsync();
|
||||
res = true;
|
||||
res = entity.GameRoundId;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -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