Spaces:
Running
Running
Download FlowAPI.Infrastructure/Repositories/AchievementRepository.cs from DanilDrotik/FlowAPI: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/spaces/DanilDrotik/FlowAPI/resolve/ecea7e2cf65ddcb1a751ceab68c14ecad830aa29/FlowAPI.Infrastructure/Repositories/AchievementRepository.cs
- Command line
-
hf download hf://spaces/DanilDrotik/FlowAPI@ecea7e2cf65ddcb1a751ceab68c14ecad830aa29/FlowAPI.Infrastructure/Repositories/AchievementRepository.cs
-
curl -L -o AchievementRepository.cs https://huggingface.co/spaces/DanilDrotik/FlowAPI/resolve/ecea7e2cf65ddcb1a751ceab68c14ecad830aa29/FlowAPI.Infrastructure/Repositories/AchievementRepository.cs
1.09 kB
| using FlowAPI.Application.Interfaces; | |
| using FlowAPI.Domain.Entities; | |
| using FlowAPI.Infrastructure.Data; | |
| using Microsoft.EntityFrameworkCore; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Threading.Tasks; | |
| namespace FlowAPI.Infrastructure.Repositories | |
| { | |
| public class AchievementRepository : GenericRepository<Achievement>, IAchievementRepository | |
| { | |
| public AchievementRepository(AppDbContext context) : base(context) | |
| { | |
| } | |
| public async Task<IEnumerable<Achievement>> GetByTriggerEventAsync(string eventName) | |
| { | |
| return await _dbSet.Where(a => a.TriggerEventName == eventName).ToListAsync(); | |
| } | |
| public async Task<IEnumerable<Achievement>> GetByTitlesAsync(IEnumerable<string> titles) | |
| { | |
| return await _dbSet.Where(a => titles.Contains(a.Title)).ToListAsync(); | |
| } | |
| public async Task AddRangeAsync(IEnumerable<Achievement> achievements) | |
| { | |
| await _dbSet.AddRangeAsync(achievements); | |
| await _context.SaveChangesAsync(); | |
| } | |
| } | |
| } | |