29 lines
840 B
C#
29 lines
840 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
|
using LCU.API.Internal.Operations.IncentiveApiLib.Persistence;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace LCU.API.Internal.Operations.IncentiveApiLib.Repositories;
|
|
|
|
public class GoalChangeRepository : BaseRepository, IGoalChangeRepository
|
|
{
|
|
public GoalChangeRepository(IApplicationDbContext context) : base(context)
|
|
{
|
|
}
|
|
|
|
public async Task<int> SaveGoalChangeAsync(GoalChange goalChange)
|
|
{
|
|
await _context.GoalChanges.AddAsync(goalChange);
|
|
return goalChange.Id;
|
|
}
|
|
|
|
public async Task<IReadOnlyCollection<GoalChange>> GetGoalChangesAsync()
|
|
{
|
|
return await _context.GoalChanges
|
|
.OrderBy(t => t.Id)
|
|
.ToListAsync();
|
|
}
|
|
}
|