65 lines
1.6 KiB
C#
65 lines
1.6 KiB
C#
using SchoolScheduleContracts.BindingModels;
|
|
using SchoolScheduleContracts.BusinessLogicsContracts;
|
|
using SchoolScheduleContracts.SearchModels;
|
|
using SchoolScheduleContracts.StoragesContracts;
|
|
using SchoolScheduleContracts.ViewModels;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace SchoolScheduleBusinessLogic
|
|
{
|
|
public class SchedulePlaceLogic : ISchedulePlaceLogic
|
|
{
|
|
private readonly ISchedulePlaceStorage _schedulePlaceStorage;
|
|
public SchedulePlaceLogic(ISchedulePlaceStorage schedulePlaceStorage)
|
|
{
|
|
_schedulePlaceStorage = schedulePlaceStorage;
|
|
}
|
|
|
|
public List<SchedulePlaceViewModel> ReadList(SchedulePlaceSearchModel? model)
|
|
{
|
|
var list = model == null ? _schedulePlaceStorage.GetFullList() :
|
|
_schedulePlaceStorage.GetFilteredList(model);
|
|
return list;
|
|
}
|
|
|
|
public SchedulePlaceViewModel? ReadElement(SchedulePlaceSearchModel model)
|
|
{
|
|
if (model == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(model));
|
|
}
|
|
var element = _schedulePlaceStorage.GetElement(model);
|
|
return element;
|
|
}
|
|
public bool Create(SchedulePlaceBindingModel model)
|
|
{
|
|
if (_schedulePlaceStorage.Insert(model) == null)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public bool Update(SchedulePlaceBindingModel model)
|
|
{
|
|
if (_schedulePlaceStorage.Update(model) == null)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public bool Delete(SchedulePlaceBindingModel model)
|
|
{
|
|
if (_schedulePlaceStorage.Delete(model) == null)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
}
|
|
}
|