интерфейсы business для коммента и покупки + в модели поиска добавила поля id пользователей (ищем только из тех, что создавал сам пользователь)

This commit is contained in:
dex_moth 2024-04-30 14:36:36 +04:00
parent 4b1d26dfb5
commit 4719cf6c0f
11 changed files with 58 additions and 21 deletions

View File

@ -92,9 +92,9 @@ namespace ComputerHardwareStoreBusinessLogic.BusinessLogic
{
return;
}
if (string.IsNullOrEmpty(model.Date))
if (string.IsNullOrEmpty(model.Text))
{
throw new ArgumentNullException("Нет даты у комментария", nameof(model.Date));
throw new ArgumentNullException("Нет текста комментария", nameof(model.Text));
}
}
}

View File

@ -92,10 +92,6 @@ namespace ComputerHardwareStoreBusinessLogic.BusinessLogic
{
return;
}
if (model.DateCreate == null) // TODO чего блин, всмысле нет
{
throw new ArgumentNullException("Нет даты создания покупки", nameof(model.Date));
}
if (model.Cost <= 0)
{
throw new ArgumentNullException("Стоимость покупки должна быть больше 0", nameof(model.Cost));

View File

@ -0,0 +1,15 @@
using ComputerHardwareStoreContracts.BindingModels;
using ComputerHardwareStoreContracts.SearchModels;
using ComputerHardwareStoreContracts.ViewModels;
namespace ComputerHardwareStoreContracts.BusinessLogicsContracts
{
public interface IBuildLogic
{
List<BuildViewModel>? ReadList(BuildSearchModel? model);
BuildViewModel? ReadElement(BuildSearchModel model);
bool Create(BuildBindingModel model);
bool Update(BuildBindingModel model);
bool Delete(BuildBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using ComputerHardwareStoreContracts.BindingModels;
using ComputerHardwareStoreContracts.SearchModels;
using ComputerHardwareStoreContracts.ViewModels;
namespace ComputerHardwareStoreContracts.BusinessLogicsContracts
{
public interface ICommentLogic
{
List<CommentViewModel>? ReadList(CommentSearchModel? model);
CommentViewModel? ReadElement(CommentSearchModel model);
bool Create(CommentBindingModel model);
bool Update(CommentBindingModel model);
bool Delete(CommentBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using ComputerHardwareStoreContracts.BindingModels;
using ComputerHardwareStoreContracts.SearchModels;
using ComputerHardwareStoreContracts.ViewModels;
namespace ComputerHardwareStoreContracts.BusinessLogicsContracts
{
public interface IPurchaseLogic
{
List<PurchaseViewModel>? ReadList(PurchaseSearchModel? model);
PurchaseViewModel? ReadElement(PurchaseSearchModel model);
bool Create(PurchaseBindingModel model);
bool Update(PurchaseBindingModel model);
bool Delete(PurchaseBindingModel model);
}
}

View File

@ -4,12 +4,12 @@ using ComputerHardwareStoreContracts.ViewModels;
namespace ComputerHardwareStoreContracts.BusinessLogicsContracts
{
public interface IStoreKeeperLogic
public interface IStoreKeeperLogic
{
List<StoreKeeperViewModel>? ReadList(StoreKeeperSearchModel? model);
StoreKeeperViewModel? ReadElement(StoreKeeperSearchModel model);
bool Create(StoreKeeperBindingModel model);
bool Update(StoreKeeperBindingModel model);
bool Delete(StoreKeeperBindingModel model);
}
List<StoreKeeperViewModel>? ReadList(StoreKeeperSearchModel? model);
StoreKeeperViewModel? ReadElement(StoreKeeperSearchModel model);
bool Create(StoreKeeperBindingModel model);
bool Update(StoreKeeperBindingModel model);
bool Delete(StoreKeeperBindingModel model);
}
}

View File

@ -6,14 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Remove="BusinessLogicsContracts\IStoreKeeperLogic.cs" />
</ItemGroup>
<ItemGroup>
<None Include="BusinessLogicsContracts\IStoreKeeperLogic.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ComputerHardwareStoreDataModels\ComputerHardwareStoreDataModels.csproj" />
</ItemGroup>

View File

@ -4,5 +4,6 @@
{
public int? Id { get; set; }
public string? Name { get; set; }
public int? VendorId { get; set; }
}
}

View File

@ -4,5 +4,6 @@
{
public int? Id { get; set; }
public string? Name { get; set; }
public int? StoreKeeperId { get; set; }
}
}

View File

@ -4,5 +4,6 @@
{
public int? Id { get; set; }
public string? Name { get; set; }
public int? StoreKeeperId { get; set; }
}
}

View File

@ -3,6 +3,7 @@
public class PurchaseSearchModel
{
public int? Id { get; set; }
public int? VendorId { get; set; }
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
}