-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWorkItemRepository.cs
More file actions
43 lines (38 loc) · 1.4 KB
/
WorkItemRepository.cs
File metadata and controls
43 lines (38 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using AzureDevopsStateTracker.Data.Context;
using AzureDevopsStateTracker.Entities;
using AzureDevopsStateTracker.Interfaces.Internals;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
namespace AzureDevopsStateTracker.Data
{
internal class WorkItemRepository : Repository<WorkItem>, IWorkItemRepository
{
public WorkItemRepository(AzureDevopsStateTrackerContext context) : base(context) { }
public WorkItem GetByWorkItemId(string workItemId)
{
return DbSet
.Include(x => x.WorkItemsChanges)
.Include(x => x.TimeByStates)
.FirstOrDefault(x => x.Id == workItemId);
}
public IEnumerable<WorkItem> ListByWorkItemId(IEnumerable<string> workItemsId)
{
return DbSet
.Include(x => x.WorkItemsChanges)
.Include(x => x.TimeByStates)
.Where(x => workItemsId.Contains(x.Id));
}
public IEnumerable<WorkItem> ListByIterationPath(string iterationPath)
{
return DbSet
.Include(x => x.WorkItemsChanges)
.Include(x => x.TimeByStates)
.Where(x => x.IterationPath == iterationPath);
}
public void RemoveAllTimeByState(List<TimeByState> timeByStates)
{
Db.TimeByStates.RemoveRange(timeByStates);
}
}
}