67 lines
1.8 KiB
C#
67 lines
1.8 KiB
C#
using DressAtelierContracts.BindingModels;
|
|
using DressAtelierContracts.SearchModels;
|
|
using DressAtelierContracts.StorageContracts;
|
|
using DressAtelierContracts.ViewModels;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace DressAtelierListImplement.Implements
|
|
{
|
|
public class MessageInfoStorage : IMessageInfoStorage
|
|
{
|
|
private readonly DataListSingleton _source;
|
|
public MessageInfoStorage(DataListSingleton source)
|
|
{
|
|
_source = DataListSingleton.GetInstance();
|
|
}
|
|
|
|
public MessageInfoViewModel? GetElement(MessageInfoSearchModel model)
|
|
{
|
|
if(string.IsNullOrEmpty(model.ID))
|
|
{
|
|
return null;
|
|
}
|
|
|
|
foreach(var msg in _source.Messages)
|
|
{
|
|
if(msg.ID.Equals(model.ID))
|
|
{
|
|
return msg.GetViewModel;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public List<MessageInfoViewModel> GetFilteredList(MessageInfoSearchModel model)
|
|
{
|
|
var list = new List<MessageInfoViewModel>();
|
|
foreach(var msg in _source.Messages)
|
|
{
|
|
if(msg.ClientID.HasValue && model.ClientID == msg.ClientID)
|
|
{
|
|
list.Add(msg.GetViewModel);
|
|
}
|
|
}
|
|
return list;
|
|
}
|
|
|
|
public List<MessageInfoViewModel> GetFullList()
|
|
{
|
|
var list = new List<MessageInfoViewModel>();
|
|
foreach(var msg in _source.Messages)
|
|
{
|
|
list.Add(msg.GetViewModel);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
public MessageInfoViewModel? Insert(MessageInfoBindingModel model)
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|