Compare commits

...

2 Commits

Author SHA1 Message Date
d3d2eef4f7 Не доделано 2024-04-06 19:58:28 +04:00
990841343f Готово 2024-04-06 17:47:40 +04:00
41 changed files with 973 additions and 22 deletions

View File

@ -15,7 +15,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CarRepairShopListImplement"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CarRepairShopFileImplement", "CarRepairShopFileImplement\CarRepairShopFileImplement.csproj", "{53D685FB-4609-4562-A930-49FAAB77BC9B}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CarRepairShopFileImplement", "CarRepairShopFileImplement\CarRepairShopFileImplement.csproj", "{53D685FB-4609-4562-A930-49FAAB77BC9B}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarRepairShopDatabaseImplement", "CarRepairShopDatabaseImplement\CarRepairShopDatabaseImplement.csproj", "{F1BAC88A-6D0D-4276-92C4-757F48D0D80F}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CarRepairShopDatabaseImplement", "CarRepairShopDatabaseImplement\CarRepairShopDatabaseImplement.csproj", "{F1BAC88A-6D0D-4276-92C4-757F48D0D80F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarRepairShopRestApi", "CarRepairShopRestApi\CarRepairShopRestApi.csproj", "{747BCB1C-6E82-4E5B-A03E-B1E66CF9182E}"
ProjectSection(ProjectDependencies) = postProject
{550ABD23-557C-41F3-97DF-DCA974DC2C91} = {550ABD23-557C-41F3-97DF-DCA974DC2C91}
{F1BAC88A-6D0D-4276-92C4-757F48D0D80F} = {F1BAC88A-6D0D-4276-92C4-757F48D0D80F}
EndProjectSection
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -51,6 +57,10 @@ Global
{F1BAC88A-6D0D-4276-92C4-757F48D0D80F}.Debug|Any CPU.Build.0 = Debug|Any CPU {F1BAC88A-6D0D-4276-92C4-757F48D0D80F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F1BAC88A-6D0D-4276-92C4-757F48D0D80F}.Release|Any CPU.ActiveCfg = Release|Any CPU {F1BAC88A-6D0D-4276-92C4-757F48D0D80F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F1BAC88A-6D0D-4276-92C4-757F48D0D80F}.Release|Any CPU.Build.0 = Release|Any CPU {F1BAC88A-6D0D-4276-92C4-757F48D0D80F}.Release|Any CPU.Build.0 = Release|Any CPU
{747BCB1C-6E82-4E5B-A03E-B1E66CF9182E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{747BCB1C-6E82-4E5B-A03E-B1E66CF9182E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{747BCB1C-6E82-4E5B-A03E-B1E66CF9182E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{747BCB1C-6E82-4E5B-A03E-B1E66CF9182E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -1,4 +1,3 @@
using CarRepairShopBusinessLogic;
using CarRepairShopBusinessLogic.BusinessLogics; using CarRepairShopBusinessLogic.BusinessLogics;
using CarRepairShopBusinessLogic.OfficePackage.Implements; using CarRepairShopBusinessLogic.OfficePackage.Implements;
using CarRepairShopBusinessLogic.OfficePackage; using CarRepairShopBusinessLogic.OfficePackage;
@ -43,6 +42,8 @@ namespace CarRepairShop
services.AddTransient<IOrderLogic, OrderLogic>(); services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IRepairLogic, RepairLogic>(); services.AddTransient<IRepairLogic, RepairLogic>();
services.AddTransient<IReportLogic, ReportLogic>(); services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<IClientLogic, ClientLogic>();
services.AddTransient<IClientStorage, ClientStorage>();
services.AddTransient<FormMain>(); services.AddTransient<FormMain>();
services.AddTransient<FormComponent>(); services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>(); services.AddTransient<FormComponents>();
@ -50,6 +51,7 @@ namespace CarRepairShop
services.AddTransient<FormRepair>(); services.AddTransient<FormRepair>();
services.AddTransient<FormRepairComponent>(); services.AddTransient<FormRepairComponent>();
services.AddTransient<FormRepairs>(); services.AddTransient<FormRepairs>();
services.AddTransient<ClientsForm>();
services.AddTransient<FormReportRepairComponents>(); services.AddTransient<FormReportRepairComponents>();
services.AddTransient<FormReportOrders>(); services.AddTransient<FormReportOrders>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>(); services.AddTransient<AbstractSaveToExcel, SaveToExcel>();

View File

@ -2,7 +2,7 @@
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"> <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<AutoRefresh>0</AutoRefresh> <AutoRefresh>0</AutoRefresh>
<DataSources> <DataSources>
<DataSource Name="RepairShopContractsViewModels"> <DataSource Name="CarRepairShopContractsViewModels">
<ConnectionProperties> <ConnectionProperties>
<DataProvider>System.Data.DataSet</DataProvider> <DataProvider>System.Data.DataSet</DataProvider>
<ConnectString>/* Local Connection */</ConnectString> <ConnectString>/* Local Connection */</ConnectString>
@ -13,7 +13,7 @@
<DataSets> <DataSets>
<DataSet Name="DataSetOrders"> <DataSet Name="DataSetOrders">
<Query> <Query>
<DataSourceName>RepairShopContractsViewModels</DataSourceName> <DataSourceName>CarRepairShopContractsViewModels</DataSourceName>
<CommandText>/* Local Query */</CommandText> <CommandText>/* Local Query */</CommandText>
</Query> </Query>
<Fields> <Fields>
@ -35,13 +35,13 @@
</Field> </Field>
<Field Name="OrderStatus"> <Field Name="OrderStatus">
<DataField>OrderStatus</DataField> <DataField>OrderStatus</DataField>
<rd:TypeName>RepairShopDataModels.OrderStatus</rd:TypeName> <rd:TypeName>CarRepairShopDataModels.OrderStatus</rd:TypeName>
</Field> </Field>
</Fields> </Fields>
<rd:DataSetInfo> <rd:DataSetInfo>
<rd:DataSetName>RepairShopContracts.ViewModels</rd:DataSetName> <rd:DataSetName>CarRepairShopContracts.ViewModels</rd:DataSetName>
<rd:TableName>ReportOrderViewModel</rd:TableName> <rd:TableName>ReportOrderViewModel</rd:TableName>
<rd:ObjectDataSourceType>RepairShopContracts.ViewModels.ReportOrderViewModel, RepairShopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType> <rd:ObjectDataSourceType>CarRepairShopContracts.ViewModels.ReportOrdersViewModel, CarRepairShopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
</rd:DataSetInfo> </rd:DataSetInfo>
</DataSet> </DataSet>
</DataSets> </DataSets>
@ -394,7 +394,6 @@
<PaddingBottom>2pt</PaddingBottom> <PaddingBottom>2pt</PaddingBottom>
</Style> </Style>
</Textbox> </Textbox>
<rd:Selected>true</rd:Selected>
</CellContents> </CellContents>
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>

View File

@ -0,0 +1,118 @@
using CarRepairShopContracts.BindingModels;
using CarRepairShopContracts.BusinessLogicsContracts;
using CarRepairShopContracts.SearchModels;
using CarRepairShopContracts.StoragesContracts;
using CarRepairShopContracts.ViewModels;
using Microsoft.Extensions.Logging;
namespace CarRepairShopBusinessLogic.BusinessLogics
{
public class ClientLogic : IClientLogic
{
private readonly ILogger _logger;
private readonly IClientStorage _clientStorage;
public ClientLogic(ILogger<ClientLogic> logger, IClientStorage
componentStorage)
{
_logger = logger;
_clientStorage = componentStorage;
}
public List<ClientViewModel>? ReadList(ClientSearchModel? model)
{
_logger.LogInformation("ReadList. ClientFIO:{ClientFIO}. Id:{ Id}", model?.ClientFIO, model?.Id);
var list = model == null ? _clientStorage.GetFullList() :
_clientStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public ClientViewModel? ReadElement(ClientSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. ClientFIO:{ClientFIO}.Id:{ Id}", model.ClientFIO, model.Id);
var element = _clientStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
public bool Create(ClientBindingModel model)
{
CheckModel(model);
if (_clientStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Update(ClientBindingModel model)
{
CheckModel(model);
if (_clientStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
public bool Delete(ClientBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_clientStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
private void CheckModel(ClientBindingModel model, bool withParams =
true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.ClientFIO))
{
throw new ArgumentNullException("Нет ФИО клиента",
nameof(model.ClientFIO));
}
if (string.IsNullOrEmpty(model.Email))
{
throw new ArgumentNullException("Нет Email клиента",
nameof(model.ClientFIO));
}
if (string.IsNullOrEmpty(model.Password))
{
throw new ArgumentNullException("Нет пароля клиента",
nameof(model.ClientFIO));
}
_logger.LogInformation("Client. ClientFIO:{ClientFIO}." +
"Email:{ Email}. Password:{ Password}. Id: { Id} ", model.ClientFIO, model.Email, model.Password, model.Id);
var element = _clientStorage.GetElement(new ClientSearchModel
{
Email = model.Email,
});
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("Клиент с таким логином уже есть");
}
}
}
}

View File

@ -5,7 +5,7 @@ using CarRepairShopContracts.StoragesContracts;
using CarRepairShopContracts.ViewModels; using CarRepairShopContracts.ViewModels;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace CarRepairShopBusinessLogic namespace CarRepairShopBusinessLogic.BusinessLogics
{ {
public class ComponentLogic : IComponentLogic public class ComponentLogic : IComponentLogic
{ {

View File

@ -6,7 +6,7 @@ using CarRepairShopContracts.ViewModels;
using CarRepairShopDataModels.Enums; using CarRepairShopDataModels.Enums;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace CarRepairShopBusinessLogic namespace CarRepairShopBusinessLogic.BusinessLogics
{ {
public class OrderLogic : IOrderLogic public class OrderLogic : IOrderLogic
{ {

View File

@ -5,7 +5,7 @@ using CarRepairShopContracts.StoragesContracts;
using CarRepairShopContracts.ViewModels; using CarRepairShopContracts.ViewModels;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace CarRepairShopBusinessLogic namespace CarRepairShopBusinessLogic.BusinessLogics
{ {
public class RepairLogic : IRepairLogic public class RepairLogic : IRepairLogic
{ {

View File

@ -0,0 +1,12 @@
using CarRepairShopDataModels;
namespace CarRepairShopContracts.BindingModels
{
public class ClientBindingModel : IClientModel
{
public int Id { get; set; }
public string ClientFIO { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
}
}

View File

@ -7,6 +7,7 @@ namespace CarRepairShopContracts.BindingModels
{ {
public int Id { get; set; } public int Id { get; set; }
public int RepairId { get; set; } public int RepairId { get; set; }
public int ClientId { get; set; }
public int Count { get; set; } public int Count { get; set; }
public double Sum { get; set; } public double Sum { get; set; }
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;

View File

@ -0,0 +1,15 @@
using CarRepairShopContracts.BindingModels;
using CarRepairShopContracts.SearchModels;
using CarRepairShopContracts.ViewModels;
namespace CarRepairShopContracts.BusinessLogicsContracts
{
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,10 @@
namespace CarRepairShopContracts.SearchModels
{
public class ClientSearchModel
{
public int? Id { get; set; }
public string? ClientFIO { get; set; }
public string? Email { get; set; }
public string? Password { get; set; }
}
}

View File

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

View File

@ -0,0 +1,16 @@
using CarRepairShopContracts.BindingModels;
using CarRepairShopContracts.SearchModels;
using CarRepairShopContracts.ViewModels;
namespace CarRepairShopContracts.StoragesContracts
{
public interface IClientStorage
{
List<ClientViewModel> GetFullList();
List<ClientViewModel> GetFilteredList(ClientSearchModel model);
ClientViewModel? GetElement(ClientSearchModel model);
ClientViewModel? Insert(ClientBindingModel model);
ClientViewModel? Update(ClientBindingModel model);
ClientViewModel? Delete(ClientBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using CarRepairShopDataModels;
using System.ComponentModel;
namespace CarRepairShopContracts.ViewModels
{
public class ClientViewModel : IClientModel
{
public int Id { get; set; }
[DisplayName("ФИО клиента")]
public string ClientFIO { get; set; } = string.Empty;
[DisplayName("Логин (эл. почта)")]
public string Email { get; set; } = string.Empty;
[DisplayName("Пароль")]
public string Password { get; set; } = string.Empty;
}
}

View File

@ -12,6 +12,10 @@ namespace CarRepairShopContracts.ViewModels
public int RepairId { get; set; } public int RepairId { get; set; }
[DisplayName("Ремонт")] [DisplayName("Ремонт")]
public string RepairName { get; set; } = string.Empty; public string RepairName { get; set; } = string.Empty;
public int ClientId { get; set; }
[DisplayName("Клиент")]
public string ClientFIO { get; set; } = string.Empty;
[DisplayName("Количество")] [DisplayName("Количество")]
public int Count { get; set; } public int Count { get; set; }
[DisplayName("Сумма")] [DisplayName("Сумма")]

View File

@ -0,0 +1,9 @@
namespace CarRepairShopDataModels
{
public interface IClientModel : IId
{
string ClientFIO { get; }
string Email { get; }
string Password { get; }
}
}

View File

@ -5,6 +5,7 @@ namespace CarRepairShopDataModels
public interface IOrderModel public interface IOrderModel
{ {
int RepairId { get; } int RepairId { get; }
int ClientId { get; }
int Count { get; } int Count { get; }
double Sum { get; } double Sum { get; }
OrderStatus Status { get; } OrderStatus Status { get; }

View File

@ -0,0 +1,81 @@
using CarRepairShopContracts.BindingModels;
using CarRepairShopContracts.SearchModels;
using CarRepairShopContracts.StoragesContracts;
using CarRepairShopContracts.ViewModels;
using CarRepairShopDatabaseImplement.Models;
namespace CarRepairShopDatabaseImplement.Implements
{
public class ClientStorage : IClientStorage
{
public List<ClientViewModel> GetFullList()
{
using var context = new RepairsShopDatabase();
return context.Clients
.Select(x => x.GetViewModel)
.ToList();
}
public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
{
if (string.IsNullOrEmpty(model.ClientFIO) && string.IsNullOrEmpty(model.Email))
{
return new();
}
using var context = new RepairsShopDatabase();
return context.Clients
.Where(x => (string.IsNullOrEmpty(model.ClientFIO) || x.ClientFIO.Contains(model.ClientFIO) &&
(string.IsNullOrEmpty(model.Email) || x.ClientFIO.Contains(model.Email))))
.Select(x => x.GetViewModel)
.ToList();
}
public ClientViewModel? GetElement(ClientSearchModel model)
{
if (string.IsNullOrEmpty(model.ClientFIO) && string.IsNullOrEmpty(model.Email) &&
!model.Id.HasValue)
{
return null;
}
using var context = new RepairsShopDatabase();
return context.Clients
.FirstOrDefault(x => (string.IsNullOrEmpty(model.ClientFIO) || x.ClientFIO == model.ClientFIO) &&
(!model.Id.HasValue || x.Id == model.Id) && (string.IsNullOrEmpty(model.Email) || x.Email == model.Email))
?.GetViewModel;
}
public ClientViewModel? Insert(ClientBindingModel model)
{
var newClient = Client.Create(model);
if (newClient == null)
{
return null;
}
using var context = new RepairsShopDatabase();
context.Clients.Add(newClient);
context.SaveChanges();
return newClient.GetViewModel;
}
public ClientViewModel? Update(ClientBindingModel model)
{
using var context = new RepairsShopDatabase();
var client = context.Clients.FirstOrDefault(x => x.Id == model.Id);
if (client == null)
{
return null;
}
client.Update(model);
context.SaveChanges();
return client.GetViewModel;
}
public ClientViewModel? Delete(ClientBindingModel model)
{
using var context = new RepairsShopDatabase();
var element = context.Clients.FirstOrDefault(rec => rec.Id == model.Id);
if (element != null)
{
context.Clients.Remove(element);
context.SaveChanges();
return element.GetViewModel;
}
return null;
}
}
}

View File

@ -22,7 +22,8 @@ namespace CarRepairShopDatabaseImplement.Implements
return context.Orders return context.Orders
.Where(x => ((!model.Id.HasValue || x.Id == model.Id) && .Where(x => ((!model.Id.HasValue || x.Id == model.Id) &&
(!model.DateFrom.HasValue || x.DateCreate >= model.DateFrom) && (!model.DateFrom.HasValue || x.DateCreate >= model.DateFrom) &&
(!model.DateTo.HasValue || x.DateCreate <= model.DateTo))) (!model.DateTo.HasValue || x.DateCreate <= model.DateTo) &&
(!model.ClientId.HasValue || x.ClientId == model.ClientId)))
.Select(x => x.GetViewModel) .Select(x => x.GetViewModel)
.ToList(); .ToList();
} }
@ -33,7 +34,7 @@ namespace CarRepairShopDatabaseImplement.Implements
return null; return null;
} }
using var context = new RepairsShopDatabase(); using var context = new RepairsShopDatabase();
return context.Orders.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel; return context.Orders.Include(x => x.Repair).Include(x => x.Client).FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
} }
public OrderViewModel? Insert(OrderBindingModel model) public OrderViewModel? Insert(OrderBindingModel model)
{ {
@ -50,7 +51,7 @@ namespace CarRepairShopDatabaseImplement.Implements
public OrderViewModel? Update(OrderBindingModel model) public OrderViewModel? Update(OrderBindingModel model)
{ {
using var context = new RepairsShopDatabase(); using var context = new RepairsShopDatabase();
var order = context.Orders.FirstOrDefault(x => x.Id == var order = context.Orders.Include(x => x.Repair).Include(x => x.Client).FirstOrDefault(x => x.Id ==
model.Id); model.Id);
if (order == null) if (order == null)
{ {
@ -63,7 +64,7 @@ namespace CarRepairShopDatabaseImplement.Implements
public OrderViewModel? Delete(OrderBindingModel model) public OrderViewModel? Delete(OrderBindingModel model)
{ {
using var context = new RepairsShopDatabase(); using var context = new RepairsShopDatabase();
var element = context.Orders.FirstOrDefault(rec => rec.Id == var element = context.Orders.Include(x => x.Repair).Include(x => x.Client).FirstOrDefault(rec => rec.Id ==
model.Id); model.Id);
if (element != null) if (element != null)
{ {

View File

@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace CarRepairShopDatabaseImplement.Migrations namespace CarRepairShopDatabaseImplement.Migrations
{ {
[DbContext(typeof(RepairsShopDatabase))] [DbContext(typeof(RepairsShopDatabase))]
[Migration("20240406120138_InitialCreate")] [Migration("20240406134528_InitialCreate")]
partial class InitialCreate partial class InitialCreate
{ {
/// <inheritdoc /> /// <inheritdoc />

View File

@ -0,0 +1,63 @@
using CarRepairShopContracts.BindingModels;
using CarRepairShopContracts.ViewModels;
using CarRepairShopDataModels;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace CarRepairShopDatabaseImplement.Models
{
public class Client : IClientModel
{
public int Id { get; private set; }
[Required]
public string ClientFIO { get; private set; } = string.Empty;
[Required]
public string Email { get; set; } = string.Empty;
[Required]
public string Password { get; set; } = string.Empty;
[ForeignKey("ClientId")]
public virtual List<Order> Orders { get; set; } =
new();
public static Client? Create(ClientBindingModel model)
{
if (model == null)
{
return null;
}
return new Client()
{
Id = model.Id,
ClientFIO = model.ClientFIO,
Email = model.Email,
Password = model.Password
};
}
public static Client Create(ClientViewModel model)
{
return new Client()
{
Id = model.Id,
ClientFIO = model.ClientFIO,
Email = model.Email,
Password = model.Password
};
}
public void Update(ClientBindingModel model)
{
if (model == null)
{
return;
}
ClientFIO = model.ClientFIO;
Email = model.Email;
Password = model.Password;
}
public ClientViewModel GetViewModel => new()
{
Id = Id,
ClientFIO = ClientFIO,
Email = Email,
Password = Password
};
}
}

View File

@ -19,6 +19,10 @@ namespace CarRepairShopDatabaseImplement.Models
public DateTime? DateImplement { get; private set; } public DateTime? DateImplement { get; private set; }
[Required] [Required]
public int RepairId { get; private set; } public int RepairId { get; private set; }
public virtual Repair? Repairs { get; private set; }
[Required]
public int ClientId { get; private set; }
public virtual Client? Client { get; private set; }
public virtual Repair? Repair { get; set; } public virtual Repair? Repair { get; set; }
public static Order? Create(OrderBindingModel model) public static Order? Create(OrderBindingModel model)
@ -32,6 +36,7 @@ namespace CarRepairShopDatabaseImplement.Models
DateCreate = model.DateCreate, DateCreate = model.DateCreate,
DateImplement = model.DateImplement, DateImplement = model.DateImplement,
RepairId = model.RepairId, RepairId = model.RepairId,
ClientId = model.ClientId,
}; };
} }
@ -48,7 +53,9 @@ namespace CarRepairShopDatabaseImplement.Models
public OrderViewModel GetViewModel => new() public OrderViewModel GetViewModel => new()
{ {
RepairId = RepairId, RepairId = RepairId,
ClientId = ClientId,
RepairName = Repair?.RepairName ?? string.Empty, RepairName = Repair?.RepairName ?? string.Empty,
ClientFIO = Client?.ClientFIO ?? string.Empty,
Count = Count, Count = Count,
Sum = Sum, Sum = Sum,
Status = Status, Status = Status,

View File

@ -18,5 +18,6 @@ namespace CarRepairShopDatabaseImplement
public virtual DbSet<Repair> Repairs { set; get; } public virtual DbSet<Repair> Repairs { set; get; }
public virtual DbSet<RepairComponent> RepairComponents { set; get; } public virtual DbSet<RepairComponent> RepairComponents { set; get; }
public virtual DbSet<Order> Orders { set; get; } public virtual DbSet<Order> Orders { set; get; }
public virtual DbSet<Client> Clients { set; get; }
} }
} }

View File

@ -9,9 +9,11 @@ namespace CarRepairShopFileImplement
private readonly string ComponentFileName = "Component.xml"; private readonly string ComponentFileName = "Component.xml";
private readonly string OrderFileName = "Order.xml"; private readonly string OrderFileName = "Order.xml";
private readonly string RepairFileName = "Repair.xml"; private readonly string RepairFileName = "Repair.xml";
private readonly string ClientFileName = "Client.xml";
public List<Component> Components { get; private set; } public List<Component> Components { get; private set; }
public List<Order> Orders { get; private set; } public List<Order> Orders { get; private set; }
public List<Repair> Repairs { get; private set; } public List<Repair> Repairs { get; private set; }
public List<Client> Clients { get; private set; }
public static DataFileSingleton GetInstance() public static DataFileSingleton GetInstance()
{ {
if (instance == null) if (instance == null)
@ -26,6 +28,8 @@ namespace CarRepairShopFileImplement
"Repairs", x => x.GetXElement); "Repairs", x => x.GetXElement);
public void SaveOrders() => SaveData(Orders, OrderFileName, public void SaveOrders() => SaveData(Orders, OrderFileName,
"Orders", x => x.GetXElement); "Orders", x => x.GetXElement);
public void SaveClients() => SaveData(Clients, ClientFileName,
"Clients", x => x.GetXElement);
private DataFileSingleton() private DataFileSingleton()
{ {
Components = LoadData(ComponentFileName, "Component", x => Components = LoadData(ComponentFileName, "Component", x =>
@ -34,6 +38,8 @@ namespace CarRepairShopFileImplement
Repair.Create(x)!)!; Repair.Create(x)!)!;
Orders = LoadData(OrderFileName, "Order", x => Orders = LoadData(OrderFileName, "Order", x =>
Order.Create(x)!)!; Order.Create(x)!)!;
Clients = LoadData(ClientFileName, "Client", x =>
Client.Create(x)!)!;
} }
private static List<T>? LoadData<T>(string filename, string xmlNodeName, private static List<T>? LoadData<T>(string filename, string xmlNodeName,
Func<XElement, T> selectFunction) Func<XElement, T> selectFunction)

View File

@ -0,0 +1,78 @@
using CarRepairShopContracts.BindingModels;
using CarRepairShopContracts.SearchModels;
using CarRepairShopContracts.StoragesContracts;
using CarRepairShopContracts.ViewModels;
using CarRepairShopFileImplement.Models;
namespace CarRepairShopFileImplement.Implements
{
public class ClientStorage : IClientStorage
{
private readonly DataFileSingleton source;
public ClientStorage()
{
source = DataFileSingleton.GetInstance();
}
public List<ClientViewModel> GetFullList()
{
return source.Clients
.Select(x => x.GetViewModel)
.ToList();
}
public List<ClientViewModel> GetFilteredList(ClientSearchModel
model)
{
if (string.IsNullOrEmpty(model.ClientFIO) && string.IsNullOrEmpty(model.Email))
{
return new();
}
return source.Clients
.Where(x => (string.IsNullOrEmpty(model.ClientFIO) || x.ClientFIO.Contains(model.ClientFIO) &&
(string.IsNullOrEmpty(model.Email) || x.ClientFIO.Contains(model.Email))))
.Select(x => x.GetViewModel)
.ToList();
}
public ClientViewModel? GetElement(ClientSearchModel model)
{
return source.Clients
.FirstOrDefault(x => (string.IsNullOrEmpty(model.ClientFIO) || x.ClientFIO == model.ClientFIO) &&
(!model.Id.HasValue || x.Id == model.Id) && (string.IsNullOrEmpty(model.Email) || x.Email == model.Email))
?.GetViewModel;
}
public ClientViewModel? Insert(ClientBindingModel model)
{
model.Id = source.Clients.Count > 0 ? source.Clients.Max(x =>
x.Id) + 1 : 1;
var newClient = Client.Create(model);
if (newClient == null)
{
return null;
}
source.Clients.Add(newClient);
source.SaveClients();
return newClient.GetViewModel;
}
public ClientViewModel? Update(ClientBindingModel model)
{
var client = source.Clients.FirstOrDefault(x => x.Id == model.Id);
if (client == null)
{
return null;
}
client.Update(model);
source.SaveClients();
return client.GetViewModel;
}
public ClientViewModel? Delete(ClientBindingModel model)
{
var element = source.Clients.FirstOrDefault(rec => rec.Id == model.Id);
if (element != null)
{
source.Clients.Remove(element);
source.SaveClients();
return element.GetViewModel;
}
return null;
}
}
}

View File

@ -23,7 +23,8 @@ namespace CarRepairShopFileImplement.Implements
{ {
return source.Orders.Where(x => ((!model.Id.HasValue || x.Id == model.Id) && return source.Orders.Where(x => ((!model.Id.HasValue || x.Id == model.Id) &&
(!model.DateFrom.HasValue || x.DateCreate >= model.DateFrom) && (!model.DateFrom.HasValue || x.DateCreate >= model.DateFrom) &&
(!model.DateTo.HasValue || x.DateCreate <= model.DateTo))) (!model.DateTo.HasValue || x.DateCreate <= model.DateTo) &&
(!model.ClientId.HasValue || x.ClientId == model.ClientId)))
.Select(x => AccessRepairStorage(x.GetViewModel)).ToList(); .Select(x => AccessRepairStorage(x.GetViewModel)).ToList();
} }
public OrderViewModel? GetElement(OrderSearchModel model) public OrderViewModel? GetElement(OrderSearchModel model)
@ -83,5 +84,15 @@ namespace CarRepairShopFileImplement.Implements
} }
return model; return model;
} }
public OrderViewModel AccessClientStorage(OrderViewModel model)
{
if (model == null)
return null;
var client = source.Clients.FirstOrDefault(x => x.Id == model.Id);
if (client != null)
model.ClientFIO = client.ClientFIO;
return model;
}
} }
} }

View File

@ -0,0 +1,67 @@
using CarRepairShopContracts.BindingModels;
using CarRepairShopContracts.ViewModels;
using CarRepairShopDataModels;
using System.Xml.Linq;
namespace CarRepairShopFileImplement.Models
{
public class Client : IClientModel
{
public int Id { get; private set; }
public string ClientFIO { get; private set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public static Client? Create(ClientBindingModel model)
{
if (model == null)
{
return null;
}
return new Client()
{
Id = model.Id,
ClientFIO = model.ClientFIO,
Email = model.Email,
Password = model.Password
};
}
public static Client? Create(XElement element)
{
if (element == null)
{
return null;
}
return new Client()
{
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
ClientFIO = element.Element("ClientFIO")!.Value,
Email = element.Element("Email")!.Value,
Password = element.Element("Password")!.Value
};
}
public void Update(ClientBindingModel model)
{
if (model == null)
{
return;
}
ClientFIO = model.ClientFIO;
Email = model.Email;
Password = model.Password;
}
public ClientViewModel GetViewModel => new()
{
Id = Id,
ClientFIO = ClientFIO,
Email = Email,
Password = Password
};
public XElement GetXElement => new("Client",
new XAttribute("Id", Id),
new XElement("ClientFIO", ClientFIO),
new XElement("Email", Email.ToString()),
new XElement("Password", Password.ToString())
);
}
}

View File

@ -10,6 +10,7 @@ namespace CarRepairShopFileImplement.Models
{ {
public int Id { get; private set; } public int Id { get; private set; }
public int RepairId { get; private set; } public int RepairId { get; private set; }
public int ClientId { get; private set; }
public int Count { get; private set; } public int Count { get; private set; }
public double Sum { get; private set; } public double Sum { get; private set; }
public OrderStatus Status { get; private set; } public OrderStatus Status { get; private set; }
@ -26,6 +27,7 @@ namespace CarRepairShopFileImplement.Models
{ {
Id = model.Id, Id = model.Id,
RepairId = model.RepairId, RepairId = model.RepairId,
ClientId = model.ClientId,
Count = model.Count, Count = model.Count,
Sum = model.Sum, Sum = model.Sum,
Status = model.Status, Status = model.Status,
@ -43,6 +45,7 @@ namespace CarRepairShopFileImplement.Models
{ {
Id = Convert.ToInt32(element.Attribute("Id")!.Value), Id = Convert.ToInt32(element.Attribute("Id")!.Value),
RepairId = Convert.ToInt32(element.Element("RepairId")!.Value), RepairId = Convert.ToInt32(element.Element("RepairId")!.Value),
ClientId = Convert.ToInt32(element.Element("ClientId")!.Value),
Count = Convert.ToInt32(element.Element("Count")!.Value), Count = Convert.ToInt32(element.Element("Count")!.Value),
Sum = Convert.ToDouble(element.Element("Sum")!.Value), Sum = Convert.ToDouble(element.Element("Sum")!.Value),
Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value.ToString()), Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value.ToString()),
@ -63,6 +66,7 @@ namespace CarRepairShopFileImplement.Models
{ {
Id = Id, Id = Id,
RepairId = RepairId, RepairId = RepairId,
ClientId = ClientId,
Count = Count, Count = Count,
Sum = Sum, Sum = Sum,
Status = Status, Status = Status,
@ -72,6 +76,7 @@ namespace CarRepairShopFileImplement.Models
public XElement GetXElement => new("Order", public XElement GetXElement => new("Order",
new XAttribute("Id", Id), new XAttribute("Id", Id),
new XElement("RepairId", RepairId), new XElement("RepairId", RepairId),
new XElement("ClientId", ClientId),
new XElement("Sum", Sum.ToString()), new XElement("Sum", Sum.ToString()),
new XElement("Count", Count), new XElement("Count", Count),
new XElement("Status", Status.ToString()), new XElement("Status", Status.ToString()),

View File

@ -8,11 +8,13 @@ namespace CarRepairShopListImplement
public List<Component> Components { get; set; } public List<Component> Components { get; set; }
public List<Order> Orders { get; set; } public List<Order> Orders { get; set; }
public List<Repair> Repairs { get; set; } public List<Repair> Repairs { get; set; }
public List<Client> Clients { get; set; }
private DataListSingleton() private DataListSingleton()
{ {
Components = new List<Component>(); Components = new List<Component>();
Orders = new List<Order>(); Orders = new List<Order>();
Repairs = new List<Repair>(); Repairs = new List<Repair>();
Clients = new List<Client>();
} }
public static DataListSingleton GetInstance() public static DataListSingleton GetInstance()
{ {

View File

@ -0,0 +1,98 @@
using CarRepairShopContracts.BindingModels;
using CarRepairShopContracts.SearchModels;
using CarRepairShopContracts.StoragesContracts;
using CarRepairShopContracts.ViewModels;
using CarRepairShopListImplement.Models;
namespace CarRepairShopListImplement.Implements
{
public class ClientStorage : IClientStorage
{
private readonly DataListSingleton _source;
public ClientStorage()
{
_source = DataListSingleton.GetInstance();
}
public List<ClientViewModel> GetFullList()
{
var result = new List<ClientViewModel>();
foreach (var client in _source.Clients)
{
result.Add(client.GetViewModel);
}
return result;
}
public List<ClientViewModel> GetFilteredList(ClientSearchModel
model)
{
var result = new List<ClientViewModel>();
if (string.IsNullOrEmpty(model.ClientFIO) && string.IsNullOrEmpty(model.Email))
{
return result;
}
foreach (var client in _source.Clients)
{
if (client.ClientFIO.Contains(model.ClientFIO))
{
result.Add(client.GetViewModel);
}
}
return result;
}
public ClientViewModel? GetElement(ClientSearchModel model)
{
foreach (var client in _source.Clients)
{
if ((string.IsNullOrEmpty(model.ClientFIO) || client.ClientFIO == model.ClientFIO) &&
(!model.Id.HasValue || client.Id == model.Id) && (string.IsNullOrEmpty(model.Email) || client.Email == model.Email))
{
return client.GetViewModel;
}
}
return null;
}
public ClientViewModel? Insert(ClientBindingModel model)
{
model.Id = 1;
foreach (var client in _source.Clients)
{
if (model.Id <= client.Id)
{
model.Id = client.Id + 1;
}
}
var newClient = Client.Create(model);
if (newClient == null)
{
return null;
}
_source.Clients.Add(newClient);
return newClient.GetViewModel;
}
public ClientViewModel? Update(ClientBindingModel model)
{
foreach (var client in _source.Clients)
{
if (client.Id == model.Id)
{
client.Update(model);
return client.GetViewModel;
}
}
return null;
}
public ClientViewModel? Delete(ClientBindingModel model)
{
for (int i = 0; i < _source.Clients.Count; ++i)
{
if (_source.Clients[i].Id == model.Id)
{
var element = _source.Clients[i];
_source.Clients.RemoveAt(i);
return element.GetViewModel;
}
}
return null;
}
}
}

View File

@ -29,7 +29,8 @@ namespace CarRepairShopListImplement.Implements
{ {
if ((!model.Id.HasValue || order.Id == model.Id) && if ((!model.Id.HasValue || order.Id == model.Id) &&
(!model.DateFrom.HasValue || order.DateCreate >= model.DateFrom) && (!model.DateFrom.HasValue || order.DateCreate >= model.DateFrom) &&
(!model.DateTo.HasValue || order.DateCreate <= model.DateTo)) (!model.DateTo.HasValue || order.DateCreate <= model.DateTo) &&
(!model.ClientId.HasValue || order.ClientId == model.ClientId))
{ {
result.Add(AccessRepairStorage(order.GetViewModel)); result.Add(AccessRepairStorage(order.GetViewModel));
} }
@ -107,5 +108,12 @@ namespace CarRepairShopListImplement.Implements
} }
return model; return model;
} }
public OrderViewModel AccessClientStorage(OrderViewModel model)
{
var client = _source.Clients.FirstOrDefault(x => x.Id == model.ClientId);
if (client != null)
model.ClientFIO = client.ClientFIO;
return model;
}
} }
} }

View File

@ -0,0 +1,45 @@
using CarRepairShopContracts.BindingModels;
using CarRepairShopContracts.ViewModels;
using CarRepairShopDataModels;
namespace CarRepairShopListImplement.Models
{
public class Client : IClientModel
{
public int Id { get; private set; }
public string ClientFIO { get; private set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public static Client? Create(ClientBindingModel model)
{
if (model == null)
{
return null;
}
return new Client()
{
Id = model.Id,
ClientFIO = model.ClientFIO,
Email = model.Email,
Password = model.Password
};
}
public void Update(ClientBindingModel model)
{
if (model == null)
{
return;
}
ClientFIO = model.ClientFIO;
Email = model.Email;
Password = model.Password;
}
public ClientViewModel GetViewModel => new()
{
Id = Id,
ClientFIO = ClientFIO,
Email = Email,
Password = Password
};
}
}

View File

@ -8,6 +8,7 @@ namespace CarRepairShopListImplement.Models
public class Order : IOrderModel public class Order : IOrderModel
{ {
public int RepairId { get; private set; } public int RepairId { get; private set; }
public int ClientId { get; private set; }
public int Count { get; private set; } public int Count { get; private set; }
public double Sum { get; private set; } public double Sum { get; private set; }
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен; public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
@ -23,6 +24,7 @@ namespace CarRepairShopListImplement.Models
return new Order return new Order
{ {
RepairId = model.RepairId, RepairId = model.RepairId,
ClientId = model.ClientId,
Count = model.Count, Count = model.Count,
Sum = model.Sum, Sum = model.Sum,
Status = model.Status, Status = model.Status,
@ -43,6 +45,7 @@ namespace CarRepairShopListImplement.Models
public OrderViewModel GetViewModel => new() public OrderViewModel GetViewModel => new()
{ {
RepairId = RepairId, RepairId = RepairId,
ClientId = ClientId,
Count = Count, Count = Count,
Sum = Sum, Sum = Sum,
DateCreate = DateCreate, DateCreate = DateCreate,

View File

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="8.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CarRepairShopBusinessLogic\CarRepairShopBusinessLogic.csproj" />
<ProjectReference Include="..\CarRepairShopDatabaseImplement\CarRepairShopDatabaseImplement.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,67 @@
using CarRepairShopContracts.BindingModels;
using CarRepairShopContracts.BusinessLogicsContracts;
using CarRepairShopContracts.SearchModels;
using CarRepairShopContracts.ViewModels;
using Microsoft.AspNetCore.Mvc;
namespace CarRepairShopRestApi.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class ClientController : Controller
{
private readonly ILogger _logger;
private readonly IClientLogic _logic;
public ClientController(IClientLogic logic, ILogger<ClientController>
logger)
{
_logger = logger;
_logic = logic;
}
[HttpGet]
public ClientViewModel? Login(string login, string password)
{
try
{
return _logic.ReadElement(new ClientSearchModel
{
Email = login,
Password = password
});
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка входа в систему");
throw;
}
}
[HttpPost]
public void Register(ClientBindingModel model)
{
try
{
_logic.Create(model);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка регистрации");
throw;
}
}
[HttpPost]
public void UpdateData(ClientBindingModel model)
{
try
{
_logic.Update(model);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка обновления данных");
throw;
}
}
}
}
}

View File

@ -0,0 +1,86 @@
using CarRepairShopContracts.BindingModels;
using CarRepairShopContracts.BusinessLogicsContracts;
using CarRepairShopContracts.SearchModels;
using CarRepairShopContracts.ViewModels;
using DocumentFormat.OpenXml.Office2010.Excel;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace CarRepairShopRestApi.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class MainController : Controller
{
private readonly ILogger _logger;
private readonly IOrderLogic _order;
private readonly IRepairLogic _repair;
public MainController(ILogger<MainController> logger, IOrderLogic order,
IRepairLogic repair)
{
_logger = logger;
_order = order;
_repair = repair;
}
[HttpGet]
public List<RepairViewModel>? GetProductList()
{
try
{
return _repair.ReadList(null);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения списка продуктов");
throw;
}
}
[HttpGet]
public RepairViewModel? GetProduct(int productId)
{
try
{
return _repair.ReadElement(new RepairSearchModel
{
Id =
productId
});
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения продукта по id={Id}",
productId);
throw;
}
}
[HttpGet]
public List<OrderViewModel>? GetOrders(int clientId)
{
try
{
return _order.ReadList(new OrderSearchModel
{
ClientId = clientId
});
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения списка заказов клиента id ={ Id}", clientId);
throw;
}
}
[HttpPost]
public void CreateOrder(OrderBindingModel model)
{
try
{
_order.CreateOrder(model);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка создания заказа");
throw;
}
}
}
}

View File

@ -0,0 +1,41 @@
using CarRepairShopBusinessLogic.BusinessLogics;
using CarRepairShopContracts.BusinessLogicsContracts;
using CarRepairShopContracts.StoragesContracts;
using CarRepairShopDatabaseImplement.Implements;
using Microsoft.OpenApi.Models;
var builder = WebApplication.CreateBuilder(args);
builder.Logging.SetMinimumLevel(LogLevel.Trace);
builder.Logging.AddLog4Net("log4net.config");
// Add services to the container.
builder.Services.AddTransient<ClientStorage, ClientStorage>();
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
builder.Services.AddTransient<IRepairStorage, RepairStorage>();
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
builder.Services.AddTransient<IClientLogic, ClientLogic>();
builder.Services.AddTransient<IRepairLogic, RepairLogic>();
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at
https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo
{
Title = "IceCreamShopRestApi",
Version
= "v1"
});
});
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json",
"IceCreamShopRestApi v1"));
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();

View File

@ -0,0 +1,31 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:35194",
"sslPort": 44389
}
},
"profiles": {
"CarRepairShopRestApi": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7136;http://localhost:5119",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}