KI-Kunst-Kirsten-Kloeckner/DataAccess/Data/WunschInfoData.cs

37 lines
1.0 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DataAccess.DbAccess;
using DataAccess.Models;
namespace DataAccess.Data;
public class WunschInfoData
{
private readonly ISqlDataAccess _db;
public WunschInfoData(ISqlDataAccess db)
{
_db = db;
}
public async Task AddWunschInfoAsync(WunschInfoModel wunschInfo)
{
var id = await _db.LoadData<int, WunschInfoModel>("dbo.spWunschInfo_Insert", wunschInfo);
wunschInfo.Id = id.Single();
}
/// <summary>
/// Gibt die WunschInfo mit der gegebenen Id zurück.
/// </summary>
/// <param name="wunschId">Die Id der zu ladenen WunschInfo</param>
/// <returns>Die WunschInfo mit der gegebenen Id</returns>
public async Task<WunschInfoModel> GetWunschInfoAsync(int wunschId)
{
var wunschInfo = await _db.LoadData<WunschInfoModel, dynamic>("dbo.spWunschInfo_Get", new { Id = wunschId });
return wunschInfo.Single();
}
}