52 lines
1.3 KiB
C#
52 lines
1.3 KiB
C#
using SushiBarContracts.BindingModels;
|
|
using SushiBarContracts.SearchModels;
|
|
using SushiBarContracts.ViewModels;
|
|
using SushiBarDatabaseImplement.Storages;
|
|
|
|
namespace SushiBarBusinessLogic
|
|
{
|
|
public class ChequeLogic
|
|
{
|
|
private readonly ChequeStorage _chequeStorage;
|
|
|
|
public ChequeLogic(ChequeStorage ChequeStorage)
|
|
{
|
|
_chequeStorage = ChequeStorage;
|
|
}
|
|
|
|
public List<ChequeViewModel>? ReadList(ChequeSearchModel? Model)
|
|
{
|
|
var List = Model is null ? _chequeStorage.GetFullList() : _chequeStorage.GetFilteredList(Model);
|
|
|
|
if (List is null)
|
|
{
|
|
return null;
|
|
}
|
|
return List;
|
|
}
|
|
|
|
public ChequeViewModel? ReadElement(ChequeSearchModel? Model)
|
|
{
|
|
if (Model is null)
|
|
throw new ArgumentNullException(nameof(Model));
|
|
|
|
var Element = _chequeStorage.GetElement(Model);
|
|
|
|
if (Element is null)
|
|
{
|
|
return null;
|
|
}
|
|
return Element;
|
|
}
|
|
|
|
public bool CreateCheque(ChequeBindingModel Model)
|
|
{
|
|
if (_chequeStorage.Insert(Model) is null)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
}
|