Skip to content

Commit dcd501f

Browse files
committed
formatted
1 parent 80a759e commit dcd501f

File tree

1 file changed

+75
-75
lines changed

1 file changed

+75
-75
lines changed
Lines changed: 75 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,92 @@
11
namespace LearningHub.Nhs.Repository.Resources
22
{
3-
using System.Collections.Generic;
4-
using System.Data;
5-
using System.Linq;
6-
using System.Threading.Tasks;
7-
using LearningHub.Nhs.Models.Entities.Resource;
8-
using LearningHub.Nhs.Models.Resource;
9-
using LearningHub.Nhs.Repository.Interface;
10-
using LearningHub.Nhs.Repository.Interface.Resources;
11-
using Microsoft.Data.SqlClient;
12-
using Microsoft.EntityFrameworkCore;
3+
using System.Collections.Generic;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
using LearningHub.Nhs.Models.Entities.Resource;
8+
using LearningHub.Nhs.Models.Resource;
9+
using LearningHub.Nhs.Repository.Interface;
10+
using LearningHub.Nhs.Repository.Interface.Resources;
11+
using Microsoft.Data.SqlClient;
12+
using Microsoft.EntityFrameworkCore;
1313

14-
/// <summary>
15-
/// The Scorm resource version repository.
16-
/// </summary>
17-
public class ScormResourceVersionRepository : GenericRepository<ScormResourceVersion>, IScormResourceVersionRepository
18-
{
1914
/// <summary>
20-
/// Initializes a new instance of the <see cref="ScormResourceVersionRepository"/> class.
15+
/// The Scorm resource version repository.
2116
/// </summary>
22-
/// <param name="dbContext">The db context.</param>
23-
/// <param name="tzOffsetManager">The Timezone offset manager.</param>
24-
public ScormResourceVersionRepository(LearningHubDbContext dbContext, ITimezoneOffsetManager tzOffsetManager)
25-
: base(dbContext, tzOffsetManager)
17+
public class ScormResourceVersionRepository : GenericRepository<ScormResourceVersion>, IScormResourceVersionRepository
2618
{
27-
}
19+
/// <summary>
20+
/// Initializes a new instance of the <see cref="ScormResourceVersionRepository"/> class.
21+
/// </summary>
22+
/// <param name="dbContext">The db context.</param>
23+
/// <param name="tzOffsetManager">The Timezone offset manager.</param>
24+
public ScormResourceVersionRepository(LearningHubDbContext dbContext, ITimezoneOffsetManager tzOffsetManager)
25+
: base(dbContext, tzOffsetManager)
26+
{
27+
}
2828

29-
/// <summary>
30-
/// The get by id async.
31-
/// </summary>
32-
/// <param name="id">The id.</param>
33-
/// <returns>The <see cref="Task"/>.</returns>
34-
public async Task<ScormResourceVersion> GetByIdAsync(int id)
35-
{
36-
return await this.DbContext.ScormResourceVersion.AsNoTracking().FirstOrDefaultAsync(r => r.Id == id && !r.Deleted);
37-
}
29+
/// <summary>
30+
/// The get by id async.
31+
/// </summary>
32+
/// <param name="id">The id.</param>
33+
/// <returns>The <see cref="Task"/>.</returns>
34+
public async Task<ScormResourceVersion> GetByIdAsync(int id)
35+
{
36+
return await this.DbContext.ScormResourceVersion.AsNoTracking().FirstOrDefaultAsync(r => r.Id == id && !r.Deleted);
37+
}
3838

39-
/// <summary>
40-
/// The get by resource version id async.
41-
/// </summary>
42-
/// <param name="resourceVersionId">The resource versionid.</param>
43-
/// <param name="includeDeleted">Allows deleted items to be returned.</param>
44-
/// <returns>The <see cref="Task"/>.</returns>
45-
public async Task<ScormResourceVersion> GetByResourceVersionIdAsync(int resourceVersionId, bool includeDeleted = false)
46-
{
47-
return await this.DbContext.ScormResourceVersion
48-
.Include(r => r.File)
49-
.Include(r => r.ScormResourceVersionManifest)
50-
.AsNoTracking().FirstOrDefaultAsync(r => r.ResourceVersionId == resourceVersionId && (includeDeleted || !r.Deleted));
51-
}
39+
/// <summary>
40+
/// The get by resource version id async.
41+
/// </summary>
42+
/// <param name="resourceVersionId">The resource versionid.</param>
43+
/// <param name="includeDeleted">Allows deleted items to be returned.</param>
44+
/// <returns>The <see cref="Task"/>.</returns>
45+
public async Task<ScormResourceVersion> GetByResourceVersionIdAsync(int resourceVersionId, bool includeDeleted = false)
46+
{
47+
return await this.DbContext.ScormResourceVersion
48+
.Include(r => r.File)
49+
.Include(r => r.ScormResourceVersionManifest)
50+
.AsNoTracking().FirstOrDefaultAsync(r => r.ResourceVersionId == resourceVersionId && (includeDeleted || !r.Deleted));
51+
}
5252

53-
/// <summary>
54-
/// Gets the SCORM content details for a particular Learning Hub external reference (guid).
55-
/// </summary>
56-
/// <param name="externalReference">The external reference (guid).</param>
57-
/// <returns>A ContentServerViewModel.</returns>
58-
public ContentServerViewModel GetContentServerDetailsByLHExternalReference(string externalReference)
59-
{
60-
var param0 = new SqlParameter("@externalReference", SqlDbType.NVarChar) { Value = externalReference };
53+
/// <summary>
54+
/// Gets the SCORM content details for a particular Learning Hub external reference (guid).
55+
/// </summary>
56+
/// <param name="externalReference">The external reference (guid).</param>
57+
/// <returns>A ContentServerViewModel.</returns>
58+
public ContentServerViewModel GetContentServerDetailsByLHExternalReference(string externalReference)
59+
{
60+
var param0 = new SqlParameter("@externalReference", SqlDbType.NVarChar) { Value = externalReference };
6161

62-
var scormContentServerViewModel = this.DbContext.ContentServerViewModel.FromSqlRaw("[resources].[GetContentServerDetailsForLHExternalReference] @externalReference", param0).AsEnumerable().FirstOrDefault();
62+
var scormContentServerViewModel = this.DbContext.ContentServerViewModel.FromSqlRaw("[resources].[GetContentServerDetailsForLHExternalReference] @externalReference", param0).AsEnumerable().FirstOrDefault();
6363

64-
return scormContentServerViewModel;
65-
}
64+
return scormContentServerViewModel;
65+
}
6666

67-
/// <summary>
68-
/// Gets the SCORM content details for a particular historic external URL. These historic URLs have to be supported to
69-
/// allow historic ESR links on migrated resources to continue to work.
70-
/// </summary>
71-
/// <param name="externalUrl">The external Url.</param>
72-
/// <returns>A ContentServerViewModel.</returns>
73-
public ContentServerViewModel GetScormContentServerDetailsByHistoricExternalUrl(string externalUrl)
74-
{
75-
var param0 = new SqlParameter("@externalUrl", SqlDbType.NVarChar) { Value = externalUrl };
67+
/// <summary>
68+
/// Gets the SCORM content details for a particular historic external URL. These historic URLs have to be supported to
69+
/// allow historic ESR links on migrated resources to continue to work.
70+
/// </summary>
71+
/// <param name="externalUrl">The external Url.</param>
72+
/// <returns>A ContentServerViewModel.</returns>
73+
public ContentServerViewModel GetScormContentServerDetailsByHistoricExternalUrl(string externalUrl)
74+
{
75+
var param0 = new SqlParameter("@externalUrl", SqlDbType.NVarChar) { Value = externalUrl };
7676

77-
var scormContentServerViewModel = this.DbContext.ContentServerViewModel.FromSqlRaw("[resources].[GetScormContentServerDetailsForHistoricExternalUrl] @externalUrl", param0).ToList().FirstOrDefault<ContentServerViewModel>();
77+
var scormContentServerViewModel = this.DbContext.ContentServerViewModel.FromSqlRaw("[resources].[GetScormContentServerDetailsForHistoricExternalUrl] @externalUrl", param0).ToList().FirstOrDefault<ContentServerViewModel>();
7878

79-
return scormContentServerViewModel;
80-
}
79+
return scormContentServerViewModel;
80+
}
8181

82-
/// <inheritdoc/>
83-
public async Task<List<string>> GetExternalReferenceByResourceId(int resourceId)
84-
{
85-
return await (from rr in this.DbContext.ResourceReference
86-
join er in this.DbContext.ExternalReference on rr.Id equals er.ResourceReferenceId
87-
where rr.ResourceId == resourceId
88-
select er.Reference)
89-
.ToListAsync();
82+
/// <inheritdoc/>
83+
public async Task<List<string>> GetExternalReferenceByResourceId(int resourceId)
84+
{
85+
return await (from rr in this.DbContext.ResourceReference
86+
join er in this.DbContext.ExternalReference on rr.Id equals er.ResourceReferenceId
87+
where rr.ResourceId == resourceId
88+
select er.Reference)
89+
.ToListAsync();
90+
}
9091
}
91-
}
9292
}

0 commit comments

Comments
 (0)