completed CompletionRepository.cs
This commit is contained in:
parent
62facb3423
commit
8fc3932df3
1 changed files with 16 additions and 12 deletions
|
|
@ -1,3 +1,4 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using SurveyLib.Core.Models;
|
||||
using SurveyLib.Core.Repositories;
|
||||
using SurveyLib.Infrastructure.EFCore.Data;
|
||||
|
|
@ -13,33 +14,36 @@ public class CompletionRepository : ICompletionRepository
|
|||
_context = context;
|
||||
}
|
||||
|
||||
public Task<Completion?> GetByIdAsync(int id)
|
||||
public async Task<Completion?> GetByIdAsync(int id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return await _context.Completions.FirstOrDefaultAsync(c => c.Id == id);
|
||||
}
|
||||
|
||||
public Task<IEnumerable<Completion>> GetAllAsync()
|
||||
public async Task<IEnumerable<Completion>> GetAllAsync()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return await _context.Completions.ToListAsync();
|
||||
}
|
||||
|
||||
public Task AddAsync(Completion entity)
|
||||
public async Task AddAsync(Completion entity)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
await _context.Completions.AddAsync(entity);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public Task UpdateAsync(Completion entity)
|
||||
public async Task UpdateAsync(Completion entity)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
_context.Completions.Update(entity);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public Task DeleteAsync(Completion entity)
|
||||
public async Task DeleteAsync(Completion entity)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
_context.Completions.Remove(entity);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public Task<IEnumerable<Completion>> GetBySurveyIdAsync(int surveyId)
|
||||
public async Task<IEnumerable<Completion>> GetBySurveyIdAsync(int surveyId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return await _context.Completions.Where(c => c.SurveyId == surveyId).ToListAsync();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue