-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathSongDataAccess.cs
More file actions
60 lines (48 loc) · 1.87 KB
/
SongDataAccess.cs
File metadata and controls
60 lines (48 loc) · 1.87 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using Dapper;
using Microsoft.Extensions.Configuration;
using SamSmithNZ.Service.DataAccess.Base;
using SamSmithNZ.Service.DataAccess.FooFighters.Interfaces;
using SamSmithNZ.Service.Models.FooFighters;
using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;
namespace SamSmithNZ.Service.DataAccess.FooFighters
{
public class SongDataAccess : BaseDataAccess<Song>, ISongDataAccess
{
public SongDataAccess(IConfiguration configuration)
{
SetupConnectionString(configuration);
}
public async Task<List<Song>> GetList()
{
return await GetList("FFL_GetSongs");
}
public async Task<List<Song>> GetListForAlbumAsync(int albumCode)
{
DynamicParameters parameters = new();
parameters.Add("@AlbumCode", albumCode, DbType.Int32);
return await GetList("FFL_GetSongs", parameters);
}
public async Task<List<Song>> GetListForShowAsync(int showCode)
{
DynamicParameters parameters = new();
parameters.Add("@ShowCode", showCode, DbType.Int32);
return await GetList("FFL_GetSongs", parameters);
}
public async Task<Song> GetItem(int songCode)
{
DynamicParameters parameters = new();
parameters.Add("@SongCode", songCode, DbType.Int32);
return await GetItem("FFL_GetSongs", parameters);
}
public async Task<bool> SaveItem(int songCode, int showCode, int showSongOrder)
{
DynamicParameters parameters = new();
parameters.Add("@SongCode", songCode, DbType.Int32);
parameters.Add("@ShowCode", showCode, DbType.Int32);
parameters.Add("@ShowSongOrder", showSongOrder, DbType.Int32);
return await SaveItem("FFL_SaveShowSong", parameters);
}
}
}