Contractor: Data models and contracts

This commit is contained in:
Safgerd 2023-04-05 22:11:17 +04:00
parent 42790d8e3b
commit ef018c1331
17 changed files with 260 additions and 8 deletions

View File

@ -16,6 +16,6 @@ namespace ComputerStoreContracts.BindingModels
public OrderStatus Status { get; set; } = OrderStatus.Unknown;
public DateTime DateCreate { get; set; } = DateTime.Now;
public DateTime? DateImplement { get; set; }
public int UserID { get; set; }
public int SellerID { get; set; }
}
}

View File

@ -0,0 +1,20 @@
using ComputerStoreDataModels.Models;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComputerStoreContracts.BindingModels
{
public class SellerBindingModel : ISellerModel
{
public int ID { get; set; }
public string Username { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public string? FirstName { get; set; } = string.Empty;
public string? LastName { get; set; } = string.Empty;
public string? MiddleName { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,20 @@
using ComputerStoreContracts.BindingModels;
using ComputerStoreContracts.SearchModels;
using ComputerStoreContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComputerStoreContracts.BusinessLogicContracts
{
public interface IConsignmentLogic
{
List<ConsignmentViewModel>? ReadList(ConsignmentSearchModel? model);
ConsignmentViewModel? ReadElement(ConsignmentSearchModel model);
bool Create(ConsignmentBindingModel model);
bool Update(ConsignmentBindingModel model);
bool Delete(ConsignmentBindingModel model);
}
}

View File

@ -0,0 +1,20 @@
using ComputerStoreContracts.BindingModels;
using ComputerStoreContracts.SearchModels;
using ComputerStoreContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComputerStoreContracts.BusinessLogicContracts
{
public interface IOrderLogic
{
List<OrderViewModel>? ReadList(OrderSearchModel? model);
OrderViewModel? ReadElement(OrderSearchModel model);
bool Create(OrderBindingModel model);
bool Update(OrderBindingModel model);
bool Delete(OrderBindingModel model);
}
}

View File

@ -0,0 +1,22 @@
using ComputerStoreContracts.BindingModels;
using ComputerStoreContracts.SearchModels;
using ComputerStoreContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComputerStoreContracts.BusinessLogicContracts
{
public interface IRequestLogic
{
List<RequestViewModel>? ReadList(RequestSearchModel? model);
RequestViewModel? ReadElement(RequestSearchModel model);
bool Create(RequestBindingModel model);
bool Update(RequestBindingModel model);
bool Delete(RequestBindingModel model);
}
}

View File

@ -0,0 +1,20 @@
using ComputerStoreContracts.BindingModels;
using ComputerStoreContracts.SearchModels;
using ComputerStoreContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComputerStoreContracts.BusinessLogicContracts
{
public interface ISellerLogic
{
List<SellerViewModel>? ReadList(SellerSearchModel? model);
SellerViewModel? ReadElement(SellerSearchModel model);
bool Create(SellerBindingModel model);
bool Update(SellerBindingModel model);
bool Delete(SellerBindingModel model);
}
}

View File

@ -11,7 +11,6 @@ namespace ComputerStoreContracts.SearchModels
public int? ID { get; set; }
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
//Временно
public int? UserID { get; set; }
public int? SellerID { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComputerStoreContracts.SearchModels
{
public class SellerSearchModel
{
public int? ID { get; set; }
public string? Username { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using ComputerStoreContracts.BindingModels;
using ComputerStoreContracts.SearchModels;
using ComputerStoreContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComputerStoreContracts.StorageContracts
{
public interface IConsignmentStorage
{
List<ConsignmentViewModel> GetFullList();
List<ConsignmentViewModel> GetFilteredList(ConsignmentSearchModel model);
ConsignmentViewModel? GetElement(ConsignmentSearchModel model);
ConsignmentViewModel? Insert(ConsignmentBindingModel model);
ConsignmentViewModel? Update(ConsignmentBindingModel model);
ConsignmentViewModel? Delete(ConsignmentBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using ComputerStoreContracts.BindingModels;
using ComputerStoreContracts.SearchModels;
using ComputerStoreContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComputerStoreContracts.StorageContracts
{
public interface IOrderStorage
{
List<OrderViewModel> GetFullList();
List<OrderViewModel> GetFilteredList(OrderSearchModel model);
OrderViewModel? GetElement(OrderSearchModel model);
OrderViewModel? Insert(OrderBindingModel model);
OrderViewModel? Update(OrderBindingModel model);
OrderViewModel? Delete(OrderBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using ComputerStoreContracts.BindingModels;
using ComputerStoreContracts.SearchModels;
using ComputerStoreContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComputerStoreContracts.StorageContracts
{
public interface IRequestStorage
{
List<RequestViewModel> GetFullList();
List<RequestViewModel> GetFilteredList(RequestSearchModel model);
RequestViewModel? GetElement(RequestSearchModel model);
RequestViewModel? Insert(RequestBindingModel model);
RequestViewModel? Update(RequestBindingModel model);
RequestViewModel? Delete(RequestBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using ComputerStoreContracts.BindingModels;
using ComputerStoreContracts.SearchModels;
using ComputerStoreContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComputerStoreContracts.StorageContracts
{
public interface ISellerStorage
{
List<SellerViewModel> GetFullList();
List<SellerViewModel> GetFilteredList(SellerSearchModel model);
SellerViewModel? GetElement(SellerSearchModel model);
SellerViewModel? Insert(SellerBindingModel model);
SellerViewModel? Update(SellerBindingModel model);
SellerViewModel? Delete(SellerBindingModel model);
}
}

View File

@ -23,7 +23,7 @@ namespace ComputerStoreContracts.ViewModels
public DateTime DateCreate { get; set; }
[DisplayName("Implementation date")]
public DateTime? DateImplement { get; set; }
[DisplayName("User ID")]
public int UserID { get; set; }
[DisplayName("Seller ID")]
public int SellerID { get; set; }
}
}

View File

@ -1,12 +1,22 @@
using System;
using ComputerStoreDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComputerStoreContracts.ViewModels
{
internal class RequestViewModel
public class RequestViewModel : IRequestModel
{
[DisplayName("Request ID")]
public int ID { get; set; }
[DisplayName("Order ID")]
public int OrderID { get; set; }
[DisplayName("Price")]
public double Price { get; set; }
[DisplayName("Count")]
public int Count { get; set; }
}
}

View File

@ -0,0 +1,26 @@
using ComputerStoreDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComputerStoreContracts.ViewModels
{
public class SellerViewModel : ISellerModel
{
[DisplayName("Seller ID")]
public int ID { get; set; }
[DisplayName("Username")]
public string Username { get; set; } = string.Empty;
[DisplayName("Password")]
public string Password { get; set; } = string.Empty;
[DisplayName("FirstName")]
public string FirstName { get; set; } = string.Empty;
[DisplayName("LastName")]
public string LastName { get; set; } = string.Empty;
[DisplayName("MiddleName")]
public string MiddleName { get; set; } = string.Empty;
}
}

View File

@ -14,6 +14,6 @@ namespace ComputerStoreDataModels.Models
OrderStatus Status { get; }
DateTime DateCreate { get; }
DateTime? DateImplement { get; }
int UserID { get; }
int SellerID { get; }
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComputerStoreDataModels.Models
{
public interface ISellerModel : IID
{
string Username { get; }
string Password { get; }
string? FirstName { get; }
string? LastName { get; }
string? MiddleName { get; }
}
}