2022-07-23 17:09:13 +02:00
|
|
|
|
using RMDataManagerLibrary.Internal.DataAccess;
|
|
|
|
|
using RMDataManagerLibrary.Models;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace RMDataManagerLibrary.DataAcccess
|
|
|
|
|
{
|
|
|
|
|
public class ProductData
|
|
|
|
|
{
|
|
|
|
|
public List<ProductModel> GetProducts()
|
|
|
|
|
{
|
|
|
|
|
SqlDataAccess sql = new SqlDataAccess();
|
|
|
|
|
|
|
|
|
|
var output = sql.LoadData<ProductModel, dynamic>("dbo.spProductGetAll", new { }, "RMData");
|
|
|
|
|
|
|
|
|
|
return output;
|
|
|
|
|
}
|
2022-07-25 17:02:36 +02:00
|
|
|
|
|
|
|
|
|
public ProductModel GetProductById(int productId)
|
|
|
|
|
{
|
|
|
|
|
SqlDataAccess sql = new SqlDataAccess();
|
|
|
|
|
|
|
|
|
|
var output = sql.LoadData<ProductModel, dynamic>("dbo.spProductGetById", new {Id = productId}, "RMData").FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
return output;
|
|
|
|
|
}
|
2022-07-23 17:09:13 +02:00
|
|
|
|
}
|
|
|
|
|
}
|