completed AnswerRepository.cs

This commit is contained in:
Вячеслав 2025-03-14 23:26:32 +05:00
parent 8fc3932df3
commit bd3c70913e

View file

@ -14,38 +14,41 @@ public class AnswerRepository : IAnswerRepository
_context = context;
}
public Task<Answer?> GetByIdAsync(int id)
public async Task<Answer?> GetByIdAsync(int id)
{
throw new NotImplementedException();
}
public Task<IEnumerable<Answer>> GetAllAsync()
public async Task<IEnumerable<Answer>> GetAllAsync()
{
throw new NotImplementedException();
return await _context.Answers.ToListAsync();
}
public Task AddAsync(Answer entity)
public async Task AddAsync(Answer entity)
{
throw new NotImplementedException();
await _context.Answers.AddAsync(entity);
await _context.SaveChangesAsync();
}
public Task UpdateAsync(Answer entity)
public async Task UpdateAsync(Answer entity)
{
throw new NotImplementedException();
_context.Answers.Update(entity);
await _context.SaveChangesAsync();
}
public Task DeleteAsync(Answer entity)
public async Task DeleteAsync(Answer entity)
{
throw new NotImplementedException();
_context.Answers.Remove(entity);
await _context.SaveChangesAsync();
}
public Task<IEnumerable<Answer>> GetByAttemptIdAsync(int attemptId)
public async Task<IEnumerable<Answer>> GetByAttemptIdAsync(int attemptId)
{
throw new NotImplementedException();
return await _context.Answers.Where(a => a.CompletionId == attemptId).ToListAsync();
}
public Task<IEnumerable<Answer>> GetByQuestionIdAsync(int questionId)
public async Task<IEnumerable<Answer>> GetByQuestionIdAsync(int questionId)
{
throw new NotImplementedException();
return await _context.Answers.Where(a => a.QuestionId == questionId).ToListAsync();
}
}