BindingModel, BusinessLogicContratcs и ViewModels

This commit is contained in:
Allllen4a 2024-04-24 14:02:00 +04:00
parent 3a086dc54b
commit d3c163d25e
15 changed files with 280 additions and 0 deletions

View File

@ -0,0 +1,17 @@
using BeautySalonDataModels.Models;
namespace BeautySalonContracts.BindingModels
{
public class ClientBindingModel : IClientModel
{
public int Id { get; set; }
public string ClientLogin { get; set; } = string.Empty;
public string ClientFIO { get; set; } = string.Empty;
public string ClientEmail { get; set; } = string.Empty;
public string ClientPassword { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,14 @@
using BeautySalonDataModels.Models;
namespace BeautySalonContracts.BindingModels
{
public class EvaluationBindingModel : IEvaluationModel
{
public int Id { get; set; }
public double PointsProcedure { get; set; }
public double PointsCosmetics { get; set; }
public int ProcedureId { get; set; }
public int ClientId { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using BeautySalonContracts.ViewModels;
using BeautySalonDataModels.Models;
using System;
using System.Collections.Generic;
namespace BeautySalonContracts.BindingModels
{
public class OrderBindingModel : IOrderModel
{
public int Id { get; set; }
public DateTime OrderDate { get; set; }
public double OrderAmount { get; set; }
public int ClientId { get; set; }
public List<OrderServiceViewModel> OrderServices { get; set; } = new();
public List<OrderCosmeticViewModel> OrderCosmetics { get; set; } = new();
public List<OrderProcedureViewModel> OrderProcedures { get; set; } = new();
}
}

View File

@ -0,0 +1,16 @@
using BeautySalonContracts.ViewModels;
using BeautySalonDataModels.Models;
using System.Collections.Generic;
namespace BeautySalonContracts.BindingModels
{
public class ProcedureBindingModel : IProcedureModel
{
public int Id { get; set; }
public string ProcedureName { get; set; } = string.Empty;
public double ProcedurePrice { get; set; }
public double ProcedureDuration { get; set; }
public int ClientId { get; set; }
public List<ProcedureEvaluationViewModel> ProcedureCosmetics { get; set; } = new();
}
}

View File

@ -0,0 +1,16 @@
using System.Collections.Generic;
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
using BeautySalonContracts.SearchModels;
namespace BeautySalonContracts.BusinessLogicContracts
{
public interface IClientLogic
{
List<ClientViewModel>? ReadList(ClientSearchModel? model);
ClientViewModel? ReadElement(ClientSearchModel model);
bool Create(ClientBindingModel model);
bool Update(ClientBindingModel model);
bool Delete(ClientBindingModel model);
}
}

View File

@ -0,0 +1,17 @@
using System.Collections.Generic;
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
using BeautySalonContracts.SearchModels;
namespace BeautySalonContracts.BusinessLogicContracts
{
public interface IEvaluationLogic
{
List<EvaluationViewModel>? ReadList(EvaluationSearchModel? model);
EvaluationViewModel? ReadElement(EvaluationSearchModel model);
bool Create(EvaluationBindingModel model);
bool Update(EvaluationBindingModel model);
bool Delete(EvaluationBindingModel model);
int GetNumberOfPages(int userId, int pageSize = 10);
}
}

View File

@ -0,0 +1,17 @@
using System.Collections.Generic;
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
using BeautySalonContracts.SearchModels;
namespace BeautySalonContracts.BusinessLogicContracts
{
public interface IOrderLogic
{
List<OrderViewModel>? ReadList(OrderSearchModel? model);
OrderViewModel? ReadElement(OrderSearchModel model);
bool Create(OrderBindingModel model);
bool Delete(OrderBindingModel model);
bool Update(OrderBindingModel model);
int GetNumberOfPages(int userId, int pageSize = 10);
}
}

View File

@ -0,0 +1,17 @@
using System.Collections.Generic;
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
using BeautySalonContracts.SearchModels;
namespace BeautySalonContracts.BusinessLogicContracts
{
public interface IProcedureLogic
{
List<ProcedureViewModel>? ReadList(ProcedureSearchModel? model);
ProcedureViewModel? ReadElement(ProcedureSearchModel model);
bool Create(ProcedureBindingModel model);
bool Update(ProcedureBindingModel model);
bool Delete(ProcedureBindingModel model);
int GetNumberOfPages(int userId, int pageSize = 10);
}
}

View File

@ -0,0 +1,27 @@
using BeautySalonDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeautySalonContracts.ViewModels
{
public class ClientViewModel : IClientModel
{
public int Id { get; set; }
[DisplayName("Логин клиента")]
public string ClientLogin { get; set; } = string.Empty;
[DisplayName("ФИО клиента")]
public string ClientFIO { get; set; } = string.Empty;
[DisplayName("Почта клиента")]
public string ClientEmail { get; set; } = string.Empty;
[DisplayName("Пароль клиента")]
public string ClientPassword { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,24 @@
using BeautySalonDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeautySalonContracts.ViewModels
{
public class EvaluationViewModel : IEvaluationModel
{
[DisplayName("Баллы за процедуру")]
public double PointsProcedure { get; set; }
[DisplayName("Баллы за косметику")]
public double PointsCosmetics { get; set; }
public int ClientId { get; set; }
public int Id { get; set; }
public int ProcedureId { get; set; }
public string ProcedureName { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,16 @@
namespace BeautySalonContracts.ViewModels
{
public class OrderCosmeticViewModel
{
public CosmeticViewModel Cosmetic { get; set; } = null!;
public int Count { get; set; }
public OrderCosmeticViewModel() { }
public OrderCosmeticViewModel(CosmeticViewModel cosmetic, int count)
{
Cosmetic = cosmetic;
Count = count;
}
}
}

View File

@ -0,0 +1,16 @@
namespace BeautySalonContracts.ViewModels
{
public class OrderProcedureViewModel
{
public ProcedureViewModel Procedure { get; set; } = null!;
public int Count { get; set; }
public OrderProcedureViewModel() { }
public OrderProcedureViewModel(ProcedureViewModel procedure, int count)
{
Procedure = procedure;
Count = count;
}
}
}

View File

@ -0,0 +1,23 @@
using BeautySalonDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeautySalonContracts.ViewModels
{
public class OrderViewModel : IOrderModel
{
[DisplayName("Дата заказа")]
public DateTime OrderDate { get; set; }
[DisplayName("Сумма")]
public double OrderAmount { get; set; }
public int ClientId { get; set; }
public int Id { get; set; }
public List<OrderServiceViewModel> OrderServices { get; set; } = new();
public List<OrderProcedureViewModel> OrderProcedures { get; set; } = new();
}
}

View File

@ -0,0 +1,16 @@
namespace BeautySalonContracts.ViewModels
{
public class ProcedureEvaluationViewModel
{
public CosmeticViewModel Cosmetic { get; set; } = null!;
public int Count { get; set; }
public ProcedureEvaluationViewModel() { }
public ProcedureEvaluationViewModel(CosmeticViewModel car, int count)
{
Cosmetic = car;
Count = count;
}
}
}

View File

@ -0,0 +1,26 @@
using BeautySalonDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeautySalonContracts.ViewModels
{
public class ProcedureViewModel : IProcedureModel
{
[DisplayName("Наименование процедуры")]
public string ProcedureName { get; set; } = string.Empty;
[DisplayName("Цена процедуры")]
public double ProcedurePrice { get; set; }
public int ClientId { get; set; }
public int Id { get; set; }
public List<ProcedureEvaluationViewModel> ProcedureCosmetics { get; set; } = new();
public List<EvaluationViewModel> ProcedureRatings { get; set; } = new();
}
}