78 lines
2.0 KiB
C#
78 lines
2.0 KiB
C#
|
using Contracts.BusinessLogicsContracts;
|
|||
|
using Contracts.ViewModels;
|
|||
|
using Contracts.BindingModels;
|
|||
|
using Contracts.StoragesContracts;
|
|||
|
using Contracts.SearchModels;
|
|||
|
|
|||
|
namespace ImplementerApp
|
|||
|
{
|
|||
|
public class ImplementerData
|
|||
|
{
|
|||
|
private readonly ILogger _logger;
|
|||
|
private readonly IImplementerLogic _implementerLogic;
|
|||
|
private readonly IDetailLogic _detailLogic;
|
|||
|
private readonly IProductionLogic _productionLogic;
|
|||
|
private readonly IProductLogic _productLogic;
|
|||
|
|
|||
|
public ImplementerData(ILogger<ImplementerData> logger, IImplementerLogic implementerLogic, IDetailLogic detailLogic, IProductionLogic productionLogic, IProductLogic productLogic)
|
|||
|
{
|
|||
|
_logger = logger;
|
|||
|
_implementerLogic = implementerLogic;
|
|||
|
_detailLogic = detailLogic;
|
|||
|
_productionLogic = productionLogic;
|
|||
|
_productLogic = productLogic;
|
|||
|
}
|
|||
|
|
|||
|
public ImplementerViewModel? Login(string login, string password)
|
|||
|
{
|
|||
|
return _implementerLogic.ReadElement(new()
|
|||
|
{
|
|||
|
Login = login,
|
|||
|
Password = password
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
public bool Register(ImplementerBindingModel model)
|
|||
|
{
|
|||
|
return _implementerLogic.Create(model);
|
|||
|
}
|
|||
|
|
|||
|
public bool UpdateUser(ImplementerBindingModel model)
|
|||
|
{
|
|||
|
return _implementerLogic.Update(model);
|
|||
|
}
|
|||
|
|
|||
|
public List<DetailViewModel>? GetDetails(int userId)
|
|||
|
{
|
|||
|
return _detailLogic.ReadList(new DetailSearchModel() { UserId = userId });
|
|||
|
}
|
|||
|
|
|||
|
public bool DeleteDetail(int detailId)
|
|||
|
{
|
|||
|
return _detailLogic.Delete(new() { Id = detailId });
|
|||
|
}
|
|||
|
public bool CreateDetail(DetailBindingModel model)
|
|||
|
{
|
|||
|
return _detailLogic.Create(model);
|
|||
|
}
|
|||
|
public bool UpdateDetail(DetailBindingModel model)
|
|||
|
{
|
|||
|
return _detailLogic.Update(model);
|
|||
|
}
|
|||
|
public DetailViewModel? GetDetail(int id)
|
|||
|
{
|
|||
|
return _detailLogic.ReadElement(new() { Id= id });
|
|||
|
}
|
|||
|
|
|||
|
public List<ProductViewModel>? GetProducts(int userId)
|
|||
|
{
|
|||
|
return _productLogic.ReadList(new ProductSearchModel() { UserId = userId });
|
|||
|
}
|
|||
|
|
|||
|
public List<ProductionViewModel>? GetProductions(int userId)
|
|||
|
{
|
|||
|
return _productionLogic.ReadList(new() { UserId = userId });
|
|||
|
}
|
|||
|
}
|
|||
|
}
|