WebAPI -> WebApp, controllers + adapters
This commit is contained in:
@@ -35,7 +35,7 @@ internal class ProductOrderBusinessLogicContract(IProductOrderStorageContract pr
|
||||
{
|
||||
return _productOrderStorageContract.GetElementById(data) ?? throw new ElementNotFoundException(data);
|
||||
}
|
||||
return _productOrderStorageContract.GetElementByName(data) ??
|
||||
return _productOrderStorageContract.GetElementByDealerName(data) ??
|
||||
throw new ElementNotFoundException(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.DataModels;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPContracts.AdapterContracts
|
||||
{
|
||||
public interface ICommentAdapter
|
||||
{
|
||||
List<CommentViewModel>? GetList();
|
||||
|
||||
CommentViewModel? GetCommentById(string id);
|
||||
|
||||
List<CommentViewModel>? GetCommentsByProductSetAndPeriod(string productSetId, DateTime fromDate, DateTime toDate);
|
||||
|
||||
List<CommentViewModel>? GetCommentsByUserAndPeriod(string userId, DateTime fromDate, DateTime toDate);
|
||||
|
||||
List<CommentViewModel>? GetCommentsByPeriod(DateTime fromDate, DateTime toDate);
|
||||
|
||||
void Create(CommentBindingModel comment);
|
||||
|
||||
void Update(CommentBindingModel comment);
|
||||
|
||||
void Delete(string id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPContracts.AdapterContracts
|
||||
{
|
||||
public interface IComponentAdapter
|
||||
{
|
||||
List<ComponentViewModel>? GetList(bool onlyActual);
|
||||
|
||||
ComponentViewModel? GetComponentByData(string data);
|
||||
|
||||
void Insert(ComponentBindingModel component);
|
||||
|
||||
void Update(ComponentBindingModel component);
|
||||
void Delete(string id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.DataModels;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPContracts.AdapterContracts
|
||||
{
|
||||
public interface IProductAdapter
|
||||
{
|
||||
List<ProductViewModel>? GetList(bool onlyActual = true);
|
||||
|
||||
ProductViewModel? GetProductByData(string data);
|
||||
|
||||
void Insert(ProductBindingModel product);
|
||||
|
||||
void Update(ProductBindingModel product);
|
||||
void Delete(string id);
|
||||
}
|
||||
}
|
||||
@@ -3,16 +3,16 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using YAPContracts.AdapterContracts.OperationResponses;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPContracts.AdapterContracts;
|
||||
|
||||
public interface IProductOrderAdapter
|
||||
{
|
||||
ProductOrderOperationResponse GetList();
|
||||
ProductOrderOperationResponse GetListByPeriod(DateTime fromDate, DateTime toDate);
|
||||
ProductOrderOperationResponse GetListByProductAndPeriod(string productId, DateTime fromDate, DateTime toDate);
|
||||
ProductOrderOperationResponse GetElement(string data);
|
||||
ProductOrderOperationResponse RegisterProductOrder(ProductOrderBindingModel productOrderModel);
|
||||
List<ProductOrderViewModel>? GetList();
|
||||
List<ProductOrderViewModel>? GetListByPeriod(DateTime fromDate, DateTime toDate);
|
||||
List<ProductOrderViewModel>? GetListByProductAndPeriod(string productId, DateTime fromDate, DateTime toDate);
|
||||
ProductOrderViewModel? GetElement(string data);
|
||||
void RegisterProductOrder(ProductOrderBindingModel productOrderModel);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.DataModels;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPContracts.AdapterContracts
|
||||
{
|
||||
public interface IProductSetAdapter
|
||||
{
|
||||
List<ProductSetViewModel>? GetList();
|
||||
ProductSetViewModel? GetProductSetByData(string data);
|
||||
|
||||
void Insert(ProductSetBindingModel productSet);
|
||||
void Update(ProductSetBindingModel productSet);
|
||||
void Delete(string id);
|
||||
}
|
||||
}
|
||||
@@ -3,26 +3,26 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using YAPContracts.AdapterContracts.OperationResponses;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.DataModels;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPContracts.AdapterContracts
|
||||
{
|
||||
public interface IPurchaseAdapter
|
||||
{
|
||||
PurchaseOperationResponse GetList();
|
||||
List<PurchaseViewModel>? GetList();
|
||||
|
||||
PurchaseOperationResponse GetElement(string id);
|
||||
PurchaseViewModel? GetElement(string id);
|
||||
|
||||
PurchaseOperationResponse GetByUserAndPeriod(string userId, DateTime fromDate, DateTime toDate);
|
||||
List<PurchaseViewModel>? GetByUserAndPeriod(string userId, DateTime fromDate, DateTime toDate);
|
||||
|
||||
PurchaseOperationResponse GetByPeriod(DateTime fromDate, DateTime toDate);
|
||||
List<PurchaseViewModel>? GetByPeriod(DateTime fromDate, DateTime toDate);
|
||||
|
||||
PurchaseOperationResponse InsertPurchase(PurchaseBindingModel purchase);
|
||||
void Register(PurchaseBindingModel purchase);
|
||||
|
||||
PurchaseOperationResponse UpdatePurchase(PurchaseBindingModel purchase);
|
||||
void Update(PurchaseBindingModel purchase);
|
||||
|
||||
PurchaseOperationResponse DeletePurchase(string id);
|
||||
void Delete(string id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,21 +3,21 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using YAPContracts.AdapterContracts.OperationResponses;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPContracts.AdapterContracts
|
||||
{
|
||||
public interface IStorekeeperAdapter
|
||||
{
|
||||
StorekeeperOperationResponse GetList();
|
||||
List<StorekeeperViewModel>? GetList();
|
||||
|
||||
StorekeeperOperationResponse GetElement(string id);
|
||||
StorekeeperViewModel? GetElement(string id);
|
||||
|
||||
StorekeeperOperationResponse Register(StorekeeperBindingModel purchase);
|
||||
void Register(StorekeeperBindingModel storekeeper);
|
||||
|
||||
StorekeeperOperationResponse Update(StorekeeperBindingModel purchase);
|
||||
void Update(StorekeeperBindingModel storekeeper);
|
||||
|
||||
StorekeeperOperationResponse Delete(string id);
|
||||
void Delete(string id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,21 +3,21 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using YAPContracts.AdapterContracts.OperationResponses;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPContracts.AdapterContracts
|
||||
{
|
||||
public interface IWorkerAdapter
|
||||
{
|
||||
WorkerOperationResponse GetList();
|
||||
List<WorkerViewModel>? GetList();
|
||||
|
||||
WorkerOperationResponse GetElement(string id);
|
||||
WorkerViewModel? GetElement(string id);
|
||||
|
||||
WorkerOperationResponse Register(WorkerBindingModel purchase);
|
||||
void Register(WorkerBindingModel worker);
|
||||
|
||||
WorkerOperationResponse Update(WorkerBindingModel purchase);
|
||||
void Update(WorkerBindingModel worker);
|
||||
|
||||
WorkerOperationResponse Delete(string id);
|
||||
void Delete(string id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace YAPContracts.AdapterContracts.OperationResponses
|
||||
{
|
||||
internal class CommentOperationResponse
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace YAPContracts.AdapterContracts.OperationResponses
|
||||
{
|
||||
internal class ComponentOperationResponse
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace YAPContracts.AdapterContracts.OperationResponses
|
||||
{
|
||||
internal class ProductOperationResponse
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using YAPContracts.Infrastructure;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPContracts.AdapterContracts.OperationResponses;
|
||||
|
||||
public class ProductOrderOperationResponse : OperationResponse
|
||||
{
|
||||
public static ProductOrderOperationResponse OK(List<ProductOrderViewModel> data) => OK<ProductOrderOperationResponse, List<ProductOrderViewModel>>(data);
|
||||
|
||||
public static ProductOrderOperationResponse OK(ProductOrderViewModel data) => OK<ProductOrderOperationResponse, ProductOrderViewModel>(data);
|
||||
|
||||
public static ProductOrderOperationResponse NoContent() => NoContent<ProductOrderOperationResponse>();
|
||||
|
||||
public static ProductOrderOperationResponse NotFound(string message) => NotFound<ProductOrderOperationResponse>(message);
|
||||
|
||||
public static ProductOrderOperationResponse BadRequest(string message) => BadRequest<ProductOrderOperationResponse>(message);
|
||||
|
||||
public static ProductOrderOperationResponse InternalServerError(string message) => InternalServerError<ProductOrderOperationResponse>(message);
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace YAPContracts.AdapterContracts.OperationResponses
|
||||
{
|
||||
internal class ProductSetOperationResponse
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using YAPContracts.Infrastructure;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPContracts.AdapterContracts.OperationResponses
|
||||
{
|
||||
public class PurchaseOperationResponse : OperationResponse
|
||||
{
|
||||
public static PurchaseOperationResponse OK(List<PurchaseViewModel> data) => OK<PurchaseOperationResponse, List<PurchaseViewModel>>(data);
|
||||
|
||||
public static PurchaseOperationResponse OK(PurchaseViewModel data) => OK<PurchaseOperationResponse, PurchaseViewModel>(data);
|
||||
|
||||
public static PurchaseOperationResponse NoContent() => NoContent<PurchaseOperationResponse>();
|
||||
|
||||
public static PurchaseOperationResponse BadRequest(string message) => BadRequest<PurchaseOperationResponse>(message);
|
||||
|
||||
public static PurchaseOperationResponse NotFound(string message) => NotFound<PurchaseOperationResponse>(message);
|
||||
|
||||
public static PurchaseOperationResponse InternalServerError(string message) => InternalServerError<PurchaseOperationResponse>(message);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using YAPContracts.Infrastructure;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPContracts.AdapterContracts.OperationResponses
|
||||
{
|
||||
public class StorekeeperOperationResponse : OperationResponse
|
||||
{
|
||||
public static StorekeeperOperationResponse OK(List<StorekeeperViewModel> data) => OK<StorekeeperOperationResponse, List<StorekeeperViewModel>>(data);
|
||||
|
||||
public static StorekeeperOperationResponse OK(StorekeeperViewModel data) => OK<StorekeeperOperationResponse, StorekeeperViewModel>(data);
|
||||
|
||||
public static StorekeeperOperationResponse NoContent() => NoContent<StorekeeperOperationResponse>();
|
||||
|
||||
public static StorekeeperOperationResponse BadRequest(string message) => BadRequest<StorekeeperOperationResponse>(message);
|
||||
|
||||
public static StorekeeperOperationResponse NotFound(string message) => NotFound<StorekeeperOperationResponse>(message);
|
||||
|
||||
public static StorekeeperOperationResponse InternalServerError(string message) => InternalServerError<StorekeeperOperationResponse>(message);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using YAPContracts.Infrastructure;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPContracts.AdapterContracts.OperationResponses
|
||||
{
|
||||
public class WorkerOperationResponse : OperationResponse
|
||||
{
|
||||
public static WorkerOperationResponse OK(List<WorkerViewModel> data) => OK<WorkerOperationResponse, List<WorkerViewModel>>(data);
|
||||
|
||||
public static WorkerOperationResponse OK(WorkerViewModel data) => OK<WorkerOperationResponse, WorkerViewModel>(data);
|
||||
|
||||
public static WorkerOperationResponse NoContent() => NoContent<WorkerOperationResponse>();
|
||||
|
||||
public static WorkerOperationResponse BadRequest(string message) => BadRequest<WorkerOperationResponse>(message);
|
||||
|
||||
public static WorkerOperationResponse NotFound(string message) => NotFound<WorkerOperationResponse>(message);
|
||||
|
||||
public static WorkerOperationResponse InternalServerError(string message) => InternalServerError<WorkerOperationResponse>(message);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ namespace YAPContracts.BusinessLogicContracts;
|
||||
|
||||
public interface IProductBusinessLogicContract
|
||||
{
|
||||
List<ProductDataModel> GetAllProducts(bool onlyActual);
|
||||
List<ProductDataModel> GetAllProducts(bool onlyActual = true);
|
||||
|
||||
ProductDataModel GetProductByData(string data);
|
||||
|
||||
|
||||
@@ -16,7 +16,5 @@ public interface IProductOrderBusinessLogicContract
|
||||
List<ProductOrderDataModel> GetProductOrdersByDealerByPeriod(string dealerName, DateTime fromDate, DateTime toDate, bool onlyActual = true);
|
||||
List<ProductOrderDataModel> GetProductOrdersByPeriod(DateTime fromDate, DateTime toDate, bool onlyActual = true);
|
||||
|
||||
|
||||
|
||||
void InsertProductOrder(ProductOrderDataModel productDataModel);
|
||||
}
|
||||
|
||||
@@ -10,14 +10,15 @@ using YAPContracts.Infrastructure;
|
||||
|
||||
namespace YAPContracts.DataModels;
|
||||
|
||||
public class ComponentDataModel(string id, string name, ComponentType componentType, bool IsDeleted, List<ComponentInProductDataModel> products, List<ComponentInProductSetDataModel> productSets) : IValidation
|
||||
public class ComponentDataModel(string id, string name, ComponentType componentType, bool IsDeleted) : IValidation
|
||||
{
|
||||
public string Id { get; private set; } = id;
|
||||
public string Name { get; private set; } = name;
|
||||
public ComponentType ComponentType { get; private set; } = componentType;
|
||||
public bool IsDeleted { get; private set; } = IsDeleted;
|
||||
public List<ComponentInProductDataModel> Products = products;
|
||||
public List<ComponentInProductSetDataModel> ProductSets = productSets;
|
||||
|
||||
// public List<ComponentInProductDataModel> Products = products;
|
||||
// public List<ComponentInProductSetDataModel> ProductSets = productSets;
|
||||
|
||||
public void Validate()
|
||||
{
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace YAPContracts.ViewModels
|
||||
{
|
||||
public string Id { get; set; } = default!;
|
||||
|
||||
public string UserId { get; set; } = default!;
|
||||
|
||||
public double TotalPrice { get; set; }
|
||||
|
||||
public DateTime PurchaseDate { get; set; }
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
<ItemGroup>
|
||||
<InternalsVisibleTo Include="YAPTests" />
|
||||
<InternalsVisibleTo Include="YAPWebAPI" />
|
||||
<InternalsVisibleTo Include="YAPWebApplication" />
|
||||
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
146
YouAreProgrammerShop/YAPWebAPI/Adapters/CommentAdapter.cs
Normal file
146
YouAreProgrammerShop/YAPWebAPI/Adapters/CommentAdapter.cs
Normal file
@@ -0,0 +1,146 @@
|
||||
using AutoMapper;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.BusinessLogicContracts;
|
||||
using YAPContracts.DataModels;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPWebAPI.Adapters
|
||||
{
|
||||
public class CommentAdapter : ICommentAdapter
|
||||
{
|
||||
private readonly ICommentBusinessLogicContract _commentBL;
|
||||
private readonly ILogger _logger;
|
||||
private readonly Mapper _mapper;
|
||||
|
||||
public CommentAdapter(ICommentBusinessLogicContract commentBL, ILogger<CommentAdapter> logger)
|
||||
{
|
||||
_commentBL = commentBL;
|
||||
_logger = logger;
|
||||
|
||||
var config = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<CommentBindingModel, CommentDataModel>();
|
||||
cfg.CreateMap<CommentDataModel, CommentViewModel>();
|
||||
cfg.CreateMap<CommentViewModel, CommentDataModel>();
|
||||
});
|
||||
|
||||
_mapper = new Mapper(config);
|
||||
}
|
||||
|
||||
public List<CommentViewModel>? GetList()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _commentBL.GetAllComments()
|
||||
.Select(x => _mapper.Map<CommentViewModel>(x))
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in CommentAdapter.GetList");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public CommentViewModel? GetCommentById(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = _commentBL.GetCommentByData(id);
|
||||
return data != null ? _mapper.Map<CommentViewModel>(data) : null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in CommentAdapter.GetCommentById");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<CommentViewModel>? GetCommentsByProductSetAndPeriod(string productSetId, DateTime fromDate, DateTime toDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _commentBL.GetCommentsByProductSetByPeriod(productSetId, fromDate, toDate)
|
||||
.Select(x => _mapper.Map<CommentViewModel>(x))
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in CommentAdapter.GetCommentsByProductSetAndPeriod");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<CommentViewModel>? GetCommentsByUserAndPeriod(string userId, DateTime fromDate, DateTime toDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _commentBL.GetCommentsByUserByPeriod(userId, fromDate, toDate)
|
||||
.Select(x => _mapper.Map<CommentViewModel>(x))
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in CommentAdapter.GetCommentsByUserAndPeriod");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<CommentViewModel>? GetCommentsByPeriod(DateTime fromDate, DateTime toDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _commentBL.GetCommentsByPeriod(fromDate, toDate)
|
||||
.Select(x => _mapper.Map<CommentViewModel>(x))
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in CommentAdapter.GetCommentsByPeriod");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Create(CommentBindingModel comment)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = _mapper.Map<CommentDataModel>(comment);
|
||||
_commentBL.InsertComment(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in CommentAdapter.Create");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(CommentBindingModel comment)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = _mapper.Map<CommentDataModel>(comment);
|
||||
_commentBL.UpdateComment(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in CommentAdapter.Update");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_commentBL.DeleteComment(id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in CommentAdapter.Delete");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
101
YouAreProgrammerShop/YAPWebAPI/Adapters/ComponentAdapter.cs
Normal file
101
YouAreProgrammerShop/YAPWebAPI/Adapters/ComponentAdapter.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
using AutoMapper;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.BusinessLogicContracts;
|
||||
using YAPContracts.DataModels;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPWebAPI.Adapters
|
||||
{
|
||||
public class ComponentAdapter : IComponentAdapter
|
||||
{
|
||||
private readonly IComponentBusinessLogicContract _productBL;
|
||||
private readonly ILogger _logger;
|
||||
private readonly Mapper _mapper;
|
||||
|
||||
public ComponentAdapter(IComponentBusinessLogicContract productBL, ILogger<ComponentAdapter> logger)
|
||||
{
|
||||
_productBL = productBL;
|
||||
_logger = logger;
|
||||
|
||||
var config = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<ComponentBindingModel, ComponentDataModel>();
|
||||
cfg.CreateMap<ComponentDataModel, ComponentViewModel>();
|
||||
cfg.CreateMap<ComponentViewModel, ComponentDataModel>();
|
||||
});
|
||||
|
||||
_mapper = new Mapper(config);
|
||||
}
|
||||
|
||||
public List<ComponentViewModel>? GetList(bool onlyActual = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _productBL.GetAllComponents(onlyActual)
|
||||
.Select(x => _mapper.Map<ComponentViewModel>(x))
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ComponentAdapter.GetList");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public ComponentViewModel? GetComponentByData(string data)
|
||||
{
|
||||
try
|
||||
{
|
||||
var model = _productBL.GetComponentByData(data);
|
||||
return model != null ? _mapper.Map<ComponentViewModel>(model) : null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ComponentAdapter.GetComponentByData");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Insert(ComponentBindingModel product)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = _mapper.Map<ComponentDataModel>(product);
|
||||
_productBL.InsertComponent(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ComponentAdapter.Insert");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(ComponentBindingModel product)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = _mapper.Map<ComponentDataModel>(product);
|
||||
_productBL.UpdateComponent(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ComponentAdapter.Update");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_productBL.DeleteComponent(id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ComponentAdapter.Delete");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
101
YouAreProgrammerShop/YAPWebAPI/Adapters/ProductAdapter.cs
Normal file
101
YouAreProgrammerShop/YAPWebAPI/Adapters/ProductAdapter.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
using AutoMapper;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.BusinessLogicContracts;
|
||||
using YAPContracts.DataModels;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPWebAPI.Adapters
|
||||
{
|
||||
public class ProductAdapter : IProductAdapter
|
||||
{
|
||||
private readonly IProductBusinessLogicContract _productBL;
|
||||
private readonly ILogger _logger;
|
||||
private readonly Mapper _mapper;
|
||||
|
||||
public ProductAdapter(IProductBusinessLogicContract productBL, ILogger<ProductAdapter> logger)
|
||||
{
|
||||
_productBL = productBL;
|
||||
_logger = logger;
|
||||
|
||||
var config = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<ProductBindingModel, ProductDataModel>();
|
||||
cfg.CreateMap<ProductDataModel, ProductViewModel>();
|
||||
cfg.CreateMap<ProductViewModel, ProductDataModel>();
|
||||
});
|
||||
|
||||
_mapper = new Mapper(config);
|
||||
}
|
||||
|
||||
public List<ProductViewModel>? GetList(bool onlyActual = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _productBL.GetAllProducts(onlyActual)
|
||||
.Select(x => _mapper.Map<ProductViewModel>(x))
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductAdapter.GetList");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public ProductViewModel? GetProductByData(string data)
|
||||
{
|
||||
try
|
||||
{
|
||||
var model = _productBL.GetProductByData(data);
|
||||
return model != null ? _mapper.Map<ProductViewModel>(model) : null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductAdapter.GetProductByData");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Insert(ProductBindingModel product)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = _mapper.Map<ProductDataModel>(product);
|
||||
_productBL.InsertProduct(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductAdapter.Insert");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(ProductBindingModel product)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = _mapper.Map<ProductDataModel>(product);
|
||||
_productBL.UpdateProduct(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductAdapter.Update");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_productBL.DeleteProduct(id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductAdapter.Delete");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using AutoMapper;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.AdapterContracts.OperationResponses;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.BusinessLogicContracts;
|
||||
using YAPContracts.DataModels;
|
||||
@@ -12,13 +11,13 @@ namespace YAPWebAPI.Adapters;
|
||||
|
||||
public class ProductOrderAdapter : IProductOrderAdapter
|
||||
{
|
||||
private readonly IProductOrderBusinessLogicContract _productOrderBusinessLogicContract;
|
||||
private readonly IProductOrderBusinessLogicContract _productOrderBL;
|
||||
private readonly ILogger _logger;
|
||||
private readonly Mapper _mapper;
|
||||
|
||||
public ProductOrderAdapter(IProductOrderBusinessLogicContract productOrderBusinessLogicContract, ILogger logger)
|
||||
public ProductOrderAdapter(IProductOrderBusinessLogicContract productOrderBL, ILogger logger)
|
||||
{
|
||||
_productOrderBusinessLogicContract = productOrderBusinessLogicContract;
|
||||
_productOrderBL = productOrderBL;
|
||||
_logger = logger;
|
||||
|
||||
var config = new MapperConfiguration(cfg =>
|
||||
@@ -30,101 +29,73 @@ public class ProductOrderAdapter : IProductOrderAdapter
|
||||
_mapper = new Mapper(config);
|
||||
}
|
||||
|
||||
public ProductOrderOperationResponse GetElement(string id)
|
||||
public List<ProductOrderViewModel>? GetList()
|
||||
{
|
||||
try
|
||||
{
|
||||
return ProductOrderOperationResponse.OK(
|
||||
_mapper.Map<ProductOrderViewModel>(_productOrderBusinessLogicContract.GetProductOrderByData(id))
|
||||
);
|
||||
}
|
||||
catch (ArgumentNullException)
|
||||
{
|
||||
return ProductOrderOperationResponse.BadRequest("Id is empty");
|
||||
}
|
||||
catch (ElementNotFoundException)
|
||||
{
|
||||
return ProductOrderOperationResponse.NotFound($"Not found productOrder by Id {id}");
|
||||
{
|
||||
var list = _productOrderBL.GetAllProductOrders();
|
||||
return list?.Select(x => _mapper.Map<ProductOrderViewModel>(x)).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Exception");
|
||||
return ProductOrderOperationResponse.InternalServerError(ex.Message);
|
||||
_logger.LogError(ex, "Error in ProductOrder GetList");
|
||||
throw new Exception("Error retrieving ProductOrders", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public ProductOrderOperationResponse GetList()
|
||||
public List<ProductOrderViewModel>? GetListByPeriod(DateTime fromDate, DateTime toDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
return ProductOrderOperationResponse.OK([.. _productOrderBusinessLogicContract.GetAllProductOrders()
|
||||
.Select(x => _mapper.Map<ProductOrderViewModel>(x))]);
|
||||
}
|
||||
catch (NullListException)
|
||||
{
|
||||
_logger.LogError("NullListException");
|
||||
return ProductOrderOperationResponse.NotFound("The list is not initialized");
|
||||
var list = _productOrderBL.GetProductOrdersByPeriod(fromDate, toDate);
|
||||
return list?.Select(x => _mapper.Map<ProductOrderViewModel>(x)).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Exception");
|
||||
return ProductOrderOperationResponse.InternalServerError(ex.Message);
|
||||
_logger.LogError(ex, "Error in ProductOrder GetListByPeriod");
|
||||
throw new Exception("Error retrieving ProductOrders by period", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public ProductOrderOperationResponse GetListByPeriod(DateTime fromDate, DateTime toDate)
|
||||
public List<ProductOrderViewModel>? GetListByProductAndPeriod(string productId, DateTime fromDate, DateTime toDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
return ProductOrderOperationResponse.OK([.. _productOrderBusinessLogicContract
|
||||
.GetProductOrdersByPeriod(fromDate, toDate)
|
||||
.Select(x => _mapper.Map<ProductOrderViewModel>(x))]);
|
||||
}
|
||||
catch (IncorrectDatesException ex)
|
||||
{
|
||||
return ProductOrderOperationResponse.BadRequest($"Incorrect date interval: {ex.Message}");
|
||||
var list = _productOrderBL.GetProductOrdersByProductByPeriod(productId, fromDate, toDate);
|
||||
return list?.Select(x => _mapper.Map<ProductOrderViewModel>(x)).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Exception");
|
||||
return ProductOrderOperationResponse.InternalServerError(ex.Message);
|
||||
_logger.LogError(ex, "Error in ProductOrder GetListByProductAndPeriod");
|
||||
throw new Exception("Error retrieving ProductOrders by product and period", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public ProductOrderOperationResponse GetListByProductAndPeriod(string productId, DateTime fromDate, DateTime toDate)
|
||||
public ProductOrderViewModel? GetElement(string data)
|
||||
{
|
||||
try
|
||||
{
|
||||
return ProductOrderOperationResponse.OK([.. _productOrderBusinessLogicContract
|
||||
.GetProductOrdersByProductByPeriod(productId, fromDate, toDate)
|
||||
.Select(x => _mapper.Map<ProductOrderViewModel>(x))]);
|
||||
}
|
||||
catch (IncorrectDatesException ex)
|
||||
{
|
||||
return ProductOrderOperationResponse.BadRequest($"Incorrect date interval: {ex.Message}");
|
||||
var order = _productOrderBL.GetProductOrderByData(data);
|
||||
return order != null ? _mapper.Map<ProductOrderViewModel>(order) : null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Exception");
|
||||
return ProductOrderOperationResponse.InternalServerError(ex.Message);
|
||||
_logger.LogError(ex, "Error in ProductOrder GetElement");
|
||||
throw new Exception("Error retrieving ProductOrder", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public ProductOrderOperationResponse RegisterProductOrder(ProductOrderBindingModel model)
|
||||
public void RegisterProductOrder(ProductOrderBindingModel productOrderModel)
|
||||
{
|
||||
try
|
||||
{
|
||||
_productOrderBusinessLogicContract.InsertProductOrder(_mapper.Map<ProductOrderDataModel>(model));
|
||||
return ProductOrderOperationResponse.NoContent();
|
||||
}
|
||||
catch (ValidationException ex)
|
||||
{
|
||||
return ProductOrderOperationResponse.BadRequest($"Incorrect data: {ex.Message}");
|
||||
var dataModel = _mapper.Map<ProductOrderDataModel>(productOrderModel);
|
||||
_productOrderBL.InsertProductOrder(dataModel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Exception");
|
||||
return ProductOrderOperationResponse.InternalServerError(ex.Message);
|
||||
_logger.LogError(ex, "Error in ProductOrder Register");
|
||||
throw new Exception("Error registering ProductOrder", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
101
YouAreProgrammerShop/YAPWebAPI/Adapters/ProductSetAdapter.cs
Normal file
101
YouAreProgrammerShop/YAPWebAPI/Adapters/ProductSetAdapter.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
using AutoMapper;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.BusinessLogicContracts;
|
||||
using YAPContracts.DataModels;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPWebAPI.Adapters
|
||||
{
|
||||
public class ProductSetAdapter : IProductSetAdapter
|
||||
{
|
||||
private readonly IProductSetBusinessLogicContract _productSetBL;
|
||||
private readonly ILogger _logger;
|
||||
private readonly Mapper _mapper;
|
||||
|
||||
public ProductSetAdapter(IProductSetBusinessLogicContract productSetBL, ILogger<ProductSetAdapter> logger)
|
||||
{
|
||||
_productSetBL = productSetBL;
|
||||
_logger = logger;
|
||||
|
||||
var config = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<ProductSetBindingModel, ProductSetDataModel>();
|
||||
cfg.CreateMap<ProductSetDataModel, ProductSetViewModel>();
|
||||
cfg.CreateMap<ProductSetViewModel, ProductSetDataModel>();
|
||||
});
|
||||
|
||||
_mapper = new Mapper(config);
|
||||
}
|
||||
|
||||
public List<ProductSetViewModel>? GetList()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _productSetBL.GetAllProductSets()
|
||||
.Select(x => _mapper.Map<ProductSetViewModel>(x))
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductSetAdapter.GetList");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public ProductSetViewModel? GetProductSetByData(string data)
|
||||
{
|
||||
try
|
||||
{
|
||||
var model = _productSetBL.GetProductSetByData(data);
|
||||
return model != null ? _mapper.Map<ProductSetViewModel>(model) : null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductSetAdapter.GetProductSetByData");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Insert(ProductSetBindingModel productSet)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = _mapper.Map<ProductSetDataModel>(productSet);
|
||||
_productSetBL.InsertProductSet(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductSetAdapter.Insert");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(ProductSetBindingModel productSet)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = _mapper.Map<ProductSetDataModel>(productSet);
|
||||
_productSetBL.UpdateProductSet(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductSetAdapter.Update");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_productSetBL.DeleteProductSet(id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductSetAdapter.Delete");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,22 @@
|
||||
namespace YAPWebAPI.Adapters
|
||||
{
|
||||
using AutoMapper;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.DataModels;
|
||||
using YAPContracts.ViewModels;
|
||||
using YAPContracts.BusinessLogicContracts;
|
||||
using YAPContracts.Exceptions;
|
||||
using YAPContracts.AdapterContracts.OperationResponses;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using AutoMapper;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.DataModels;
|
||||
using YAPContracts.ViewModels;
|
||||
using YAPContracts.BusinessLogicContracts;
|
||||
using YAPContracts.Exceptions;
|
||||
using YAPContracts.AdapterContracts;
|
||||
|
||||
namespace YAPWebAPI.Adapters
|
||||
{
|
||||
public class PurchaseAdapter : IPurchaseAdapter
|
||||
{
|
||||
private readonly IPurchaseBusinessLogicContract _purchaseBusinessLogicContract;
|
||||
private readonly IPurchaseBusinessLogicContract _purchaseBL;
|
||||
private readonly ILogger _logger;
|
||||
private readonly Mapper _mapper;
|
||||
|
||||
public PurchaseAdapter(IPurchaseBusinessLogicContract purchaseBusinessLogicContract, ILogger logger)
|
||||
public PurchaseAdapter(IPurchaseBusinessLogicContract purchaseBL, ILogger logger)
|
||||
{
|
||||
_purchaseBusinessLogicContract = purchaseBusinessLogicContract;
|
||||
_purchaseBL = purchaseBL;
|
||||
_logger = logger;
|
||||
|
||||
var config = new MapperConfiguration(cfg =>
|
||||
@@ -30,139 +28,104 @@
|
||||
_mapper = new Mapper(config);
|
||||
}
|
||||
|
||||
public PurchaseOperationResponse GetList()
|
||||
public List<PurchaseViewModel> GetList()
|
||||
{
|
||||
try
|
||||
{
|
||||
return PurchaseOperationResponse.OK([.. _purchaseBusinessLogicContract.GetAllPurchases()
|
||||
.Select(x => _mapper.Map<PurchaseViewModel>(x))]);
|
||||
}
|
||||
catch (NullListException)
|
||||
{
|
||||
_logger.LogError("NullListException");
|
||||
return PurchaseOperationResponse.NotFound("The list is not initialized");
|
||||
var purchases = _purchaseBL.GetAllPurchases();
|
||||
return purchases.Select(x => _mapper.Map<PurchaseViewModel>(x)).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Exception");
|
||||
return PurchaseOperationResponse.InternalServerError(ex.Message);
|
||||
_logger.LogError(ex, "Error in Purchase GetList");
|
||||
throw new Exception("Error retrieving purchases list", ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public PurchaseViewModel? GetElement(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var purchase = _purchaseBL.GetPurchaseByData(id);
|
||||
return purchase != null ? _mapper.Map<PurchaseViewModel>(purchase) : null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Purchase GetElement");
|
||||
throw new Exception("Error retrieving purchase", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public PurchaseOperationResponse GetElement(string id)
|
||||
public void Register(PurchaseBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
return PurchaseOperationResponse.OK(
|
||||
_mapper.Map<PurchaseViewModel>(_purchaseBusinessLogicContract.GetPurchaseByData(id))
|
||||
);
|
||||
}
|
||||
catch (ArgumentNullException)
|
||||
{
|
||||
return PurchaseOperationResponse.BadRequest("Id is empty");
|
||||
}
|
||||
catch (ElementNotFoundException)
|
||||
{
|
||||
return PurchaseOperationResponse.NotFound($"Not found purchase by Id {id}");
|
||||
var dataModel = _mapper.Map<PurchaseDataModel>(model);
|
||||
_purchaseBL.InsertPurchase(dataModel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Exception");
|
||||
return PurchaseOperationResponse.InternalServerError(ex.Message);
|
||||
_logger.LogError(ex, "Error in Purchase Register");
|
||||
throw new Exception("Error creating purchase", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public PurchaseOperationResponse GetByUserAndPeriod(string userId, DateTime fromDate, DateTime toDate)
|
||||
public void Update(PurchaseBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
return PurchaseOperationResponse.OK([.. _purchaseBusinessLogicContract
|
||||
.GetPurchasesByUserByPeriod(userId, fromDate, toDate)
|
||||
.Select(x => _mapper.Map<PurchaseViewModel>(x))]);
|
||||
}
|
||||
catch (IncorrectDatesException ex)
|
||||
{
|
||||
return PurchaseOperationResponse.BadRequest($"Incorrect date interval: {ex.Message}");
|
||||
{
|
||||
var dataModel = _mapper.Map<PurchaseDataModel>(model);
|
||||
_purchaseBL.UpdatePurchase(dataModel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Exception");
|
||||
return PurchaseOperationResponse.InternalServerError(ex.Message);
|
||||
_logger.LogError(ex, "Error in Purchase Update");
|
||||
throw new Exception("Error updating purchase", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public PurchaseOperationResponse GetByPeriod(DateTime fromDate, DateTime toDate)
|
||||
public void Delete(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return PurchaseOperationResponse.OK([.. _purchaseBusinessLogicContract
|
||||
.GetPurchasesByPeriod(fromDate, toDate)
|
||||
.Select(x => _mapper.Map<PurchaseViewModel>(x))]);
|
||||
}
|
||||
catch (IncorrectDatesException ex)
|
||||
{
|
||||
return PurchaseOperationResponse.BadRequest($"Incorrect date interval: {ex.Message}");
|
||||
_purchaseBL.DeletePurchase(id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Exception");
|
||||
return PurchaseOperationResponse.InternalServerError(ex.Message);
|
||||
_logger.LogError(ex, "Error in Purchase Delete");
|
||||
throw new Exception("Error deleting purchase", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public PurchaseOperationResponse InsertPurchase(PurchaseBindingModel model)
|
||||
public List<PurchaseViewModel> GetByUserAndPeriod(string userId, DateTime fromDate, DateTime toDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
_purchaseBusinessLogicContract.InsertPurchase(_mapper.Map<PurchaseDataModel>(model));
|
||||
return PurchaseOperationResponse.NoContent();
|
||||
}
|
||||
catch (ValidationException ex)
|
||||
{
|
||||
return PurchaseOperationResponse.BadRequest($"Incorrect data: {ex.Message}");
|
||||
var purchases = _purchaseBL.GetPurchasesByUserByPeriod(userId, fromDate, toDate);
|
||||
return purchases.Select(x => _mapper.Map<PurchaseViewModel>(x)).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Exception");
|
||||
return PurchaseOperationResponse.InternalServerError(ex.Message);
|
||||
_logger.LogError(ex, "Error in Purchase GetByUserAndPeriod");
|
||||
throw new Exception("Error retrieving purchases list by user and period", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public PurchaseOperationResponse UpdatePurchase(PurchaseBindingModel model)
|
||||
public List<PurchaseViewModel> GetByPeriod(DateTime fromDate, DateTime toDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
_purchaseBusinessLogicContract.UpdatePurchase(_mapper.Map<PurchaseDataModel>(model));
|
||||
return PurchaseOperationResponse.NoContent();
|
||||
}
|
||||
catch (ElementNotFoundException)
|
||||
{
|
||||
return PurchaseOperationResponse.NotFound($"Purchase not found by Id {model.Id}");
|
||||
{
|
||||
var purchases = _purchaseBL.GetPurchasesByPeriod(fromDate, toDate);
|
||||
return purchases.Select(x => _mapper.Map<PurchaseViewModel>(x)).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Exception");
|
||||
return PurchaseOperationResponse.InternalServerError(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public PurchaseOperationResponse DeletePurchase(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_purchaseBusinessLogicContract.DeletePurchase(id);
|
||||
return PurchaseOperationResponse.NoContent();
|
||||
}
|
||||
catch (ElementNotFoundException)
|
||||
{
|
||||
return PurchaseOperationResponse.NotFound($"Purchase not found by Id {id}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Exception");
|
||||
return PurchaseOperationResponse.InternalServerError(ex.Message);
|
||||
_logger.LogError(ex, "Error in Purchase GetByPeriod");
|
||||
throw new Exception("Error retrieving purchases list by period", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using AutoMapper;
|
||||
using YAPContracts.AdapterContracts.OperationResponses;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.BusinessLogicContracts;
|
||||
using YAPContracts.DataModels.UserRoles;
|
||||
using YAPContracts.Extentions;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPWebAPI.Adapters
|
||||
@@ -28,75 +28,82 @@ namespace YAPWebAPI.Adapters
|
||||
_mapper = new Mapper(config);
|
||||
}
|
||||
|
||||
public StorekeeperOperationResponse GetList()
|
||||
public List<StorekeeperViewModel> GetList()
|
||||
{
|
||||
try
|
||||
{
|
||||
return StorekeeperOperationResponse.OK(
|
||||
[.. _storekeeperBusinessLogic.GetAllStorekeepers().Select(x => _mapper.Map<StorekeeperViewModel>(x))]
|
||||
);
|
||||
return _storekeeperBusinessLogic.GetAllStorekeepers()
|
||||
.Select(x => _mapper.Map<StorekeeperViewModel>(x)).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in GetList");
|
||||
return StorekeeperOperationResponse.InternalServerError(ex.Message);
|
||||
// Handle exceptions as needed, e.g., log them or rethrow
|
||||
_logger.LogError(ex, "Error in Storekeeper GetList");
|
||||
throw new Exception("Error retrieving users list", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public StorekeeperOperationResponse GetElement(string data)
|
||||
public StorekeeperViewModel? GetElement(string data)
|
||||
{
|
||||
try
|
||||
{
|
||||
return StorekeeperOperationResponse.OK(
|
||||
_mapper.Map<StorekeeperViewModel>(_storekeeperBusinessLogic.GetStorekeeperByData(data))
|
||||
);
|
||||
var dataModel = _storekeeperBusinessLogic.GetStorekeeperByData(data);
|
||||
return dataModel != null ? _mapper.Map<StorekeeperViewModel>(dataModel) : null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in GetElement");
|
||||
return StorekeeperOperationResponse.InternalServerError(ex.Message);
|
||||
_logger.LogError(ex, "Error in Storekeeper GetElement");
|
||||
throw new Exception($"Error retrieving user with data {data}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public StorekeeperOperationResponse Register(StorekeeperBindingModel model)
|
||||
public void Register(StorekeeperBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_storekeeperBusinessLogic.InsertStorekeeper(_mapper.Map<StorekeeperDataModel>(model));
|
||||
return StorekeeperOperationResponse.NoContent();
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model), "User data model cannot be null");
|
||||
}
|
||||
var dataModel = _mapper.Map<StorekeeperDataModel>(model);
|
||||
_storekeeperBusinessLogic.InsertStorekeeper(dataModel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Register");
|
||||
return StorekeeperOperationResponse.InternalServerError(ex.Message);
|
||||
_logger.LogError(ex, "Error in Storekeeper Register");
|
||||
throw new Exception("Error adding user data model", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public StorekeeperOperationResponse Update(StorekeeperBindingModel model)
|
||||
public void Update(StorekeeperBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_storekeeperBusinessLogic.UpdateStorekeeper(_mapper.Map<StorekeeperDataModel>(model));
|
||||
return StorekeeperOperationResponse.NoContent();
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model), "User data model cannot be null");
|
||||
}
|
||||
var dataModel = _mapper.Map<StorekeeperDataModel>(model);
|
||||
_storekeeperBusinessLogic.UpdateStorekeeper(dataModel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Update");
|
||||
return StorekeeperOperationResponse.InternalServerError(ex.Message);
|
||||
_logger.LogError(ex, "Error in Storekeeper Update");
|
||||
throw new Exception("Error adding user data model", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public StorekeeperOperationResponse Delete(string id)
|
||||
public void Delete(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!id.IsGuid()) throw new ArgumentException(nameof(id), "Incorrect Id");
|
||||
_storekeeperBusinessLogic.DeleteStorekeeper(id);
|
||||
return StorekeeperOperationResponse.NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Delete");
|
||||
return StorekeeperOperationResponse.InternalServerError(ex.Message);
|
||||
// Handle exceptions as needed, e.g., log them or rethrow
|
||||
_logger.LogError(ex, "Error in Storekeeper Delete");
|
||||
throw new Exception($"Error deleting purchase with ID {id}", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
using AutoMapper;
|
||||
using YAPContracts.AdapterContracts.OperationResponses;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.BusinessLogicContracts;
|
||||
using YAPContracts.DataModels;
|
||||
using YAPContracts.DataModels.UserRoles;
|
||||
using YAPContracts.Extentions;
|
||||
using YAPContracts.ViewModels;
|
||||
using YAPDatabase.Models;
|
||||
|
||||
namespace YAPWebAPI.Adapters
|
||||
{
|
||||
public class WorkerAdapter : IWorkerAdapter
|
||||
{
|
||||
private readonly IWorkerBusinessLogicContract _workerBusinessLogic;
|
||||
private readonly IWorkerBusinessLogicContract _workerBL;
|
||||
private readonly ILogger _logger;
|
||||
private readonly Mapper _mapper;
|
||||
|
||||
public WorkerAdapter(IWorkerBusinessLogicContract workerBusinessLogic, ILogger logger)
|
||||
public WorkerAdapter(IWorkerBusinessLogicContract workerBL, ILogger logger)
|
||||
{
|
||||
_workerBusinessLogic = workerBusinessLogic;
|
||||
_logger = logger;
|
||||
|
||||
_workerBL = workerBL;
|
||||
var config = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<WorkerBindingModel, WorkerDataModel>();
|
||||
@@ -26,77 +27,85 @@ namespace YAPWebAPI.Adapters
|
||||
cfg.CreateMap<WorkerViewModel, WorkerDataModel>();
|
||||
});
|
||||
_mapper = new Mapper(config);
|
||||
|
||||
}
|
||||
|
||||
public WorkerOperationResponse GetList()
|
||||
public List<WorkerViewModel> GetList()
|
||||
{
|
||||
try
|
||||
{
|
||||
return WorkerOperationResponse.OK(
|
||||
[.. _workerBusinessLogic.GetAllWorkers().Select(x => _mapper.Map<WorkerViewModel>(x))]
|
||||
);
|
||||
return _workerBL.GetAllWorkers()
|
||||
.Select(x => _mapper.Map<WorkerViewModel>(x)).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in GetList");
|
||||
return WorkerOperationResponse.InternalServerError(ex.Message);
|
||||
// Handle exceptions as needed, e.g., log them or rethrow
|
||||
_logger.LogError(ex, "Error in Worker GetList");
|
||||
throw new Exception("Error retrieving users list", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public WorkerOperationResponse GetElement(string data)
|
||||
public WorkerViewModel? GetElement(string data)
|
||||
{
|
||||
try
|
||||
{
|
||||
return WorkerOperationResponse.OK(
|
||||
_mapper.Map<WorkerViewModel>(_workerBusinessLogic.GetWorkerByData(data))
|
||||
);
|
||||
var dataModel = _workerBL.GetWorkerByData(data);
|
||||
return dataModel != null ? _mapper.Map<WorkerViewModel>(dataModel) : null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in GetElement");
|
||||
return WorkerOperationResponse.InternalServerError(ex.Message);
|
||||
_logger.LogError(ex, "Error in Worker GetElement");
|
||||
throw new Exception($"Error retrieving user with data {data}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public WorkerOperationResponse Register(WorkerBindingModel model)
|
||||
public void Register(WorkerBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_workerBusinessLogic.InsertWorker(_mapper.Map<WorkerDataModel>(model));
|
||||
return WorkerOperationResponse.NoContent();
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model), "User data model cannot be null");
|
||||
}
|
||||
var dataModel = _mapper.Map<WorkerDataModel>(model);
|
||||
_workerBL.InsertWorker(dataModel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Register");
|
||||
return WorkerOperationResponse.InternalServerError(ex.Message);
|
||||
_logger.LogError(ex, "Error in Worker Register");
|
||||
throw new Exception("Error adding user data model", ex);
|
||||
}
|
||||
}
|
||||
public void Update(WorkerBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model), "User data model cannot be null");
|
||||
}
|
||||
var dataModel = _mapper.Map<WorkerDataModel>(model);
|
||||
_workerBL.UpdateWorker(dataModel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Worker Update");
|
||||
throw new Exception("Error adding user data model", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public WorkerOperationResponse Update(WorkerBindingModel model)
|
||||
public void Delete(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_workerBusinessLogic.UpdateWorker(_mapper.Map<WorkerDataModel>(model));
|
||||
return WorkerOperationResponse.NoContent();
|
||||
if (!id.IsGuid()) throw new ArgumentException(nameof(id), "Incorrect Id");
|
||||
_workerBL.DeleteWorker(id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Update");
|
||||
return WorkerOperationResponse.InternalServerError(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public WorkerOperationResponse Delete(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_workerBusinessLogic.DeleteWorker(id);
|
||||
return WorkerOperationResponse.NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Delete");
|
||||
return WorkerOperationResponse.InternalServerError(ex.Message);
|
||||
// Handle exceptions as needed, e.g., log them or rethrow
|
||||
_logger.LogError(ex, "Error in Worker Delete");
|
||||
throw new Exception($"Error deleting purchase with ID {id}", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
|
||||
namespace YAPWebAPI.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
public class CommentController : Controller
|
||||
{
|
||||
private readonly ICommentAdapter _commentAdapter;
|
||||
|
||||
public CommentController(ICommentAdapter commentAdapter)
|
||||
{
|
||||
_commentAdapter = commentAdapter;
|
||||
}
|
||||
|
||||
// GET: /Comment/
|
||||
public IActionResult Index()
|
||||
{
|
||||
var comments = _commentAdapter.GetList();
|
||||
return View(comments);
|
||||
}
|
||||
|
||||
// GET: /Comment/Details/{id}
|
||||
public IActionResult Details(string id)
|
||||
{
|
||||
var comment = _commentAdapter.GetCommentById(id);
|
||||
if (comment == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(comment);
|
||||
}
|
||||
|
||||
// GET: /Comment/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: /Comment/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Create(CommentBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_commentAdapter.Create(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// GET: /Comment/Edit/{id}
|
||||
public IActionResult Edit(string id)
|
||||
{
|
||||
var comment = _commentAdapter.GetCommentById(id);
|
||||
if (comment == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(comment);
|
||||
}
|
||||
|
||||
// POST: /Comment/Edit
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Edit(CommentBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_commentAdapter.Update(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// GET: /Comment/Delete/{id}
|
||||
public IActionResult Delete(string id)
|
||||
{
|
||||
var comment = _commentAdapter.GetCommentById(id);
|
||||
if (comment == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(comment);
|
||||
}
|
||||
|
||||
// POST: /Comment/Delete
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult DeleteConfirmed(string id)
|
||||
{
|
||||
_commentAdapter.Delete(id);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
|
||||
namespace YAPWebAPI.Controllers
|
||||
{
|
||||
public class ProductController : Controller
|
||||
{
|
||||
private readonly IProductAdapter _productAdapter;
|
||||
|
||||
public ProductController(IProductAdapter productAdapter)
|
||||
{
|
||||
_productAdapter = productAdapter;
|
||||
}
|
||||
|
||||
// GET: /Product/
|
||||
public IActionResult Index()
|
||||
{
|
||||
var sets = _productAdapter.GetList();
|
||||
return View(sets);
|
||||
}
|
||||
|
||||
// GET: /Product/Details/{id}
|
||||
public IActionResult Details(string id)
|
||||
{
|
||||
var set = _productAdapter.GetProductByData(id);
|
||||
if (set == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(set);
|
||||
}
|
||||
|
||||
// GET: /Product/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: /Product/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Create(ProductBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_productAdapter.Insert(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// GET: /Product/Edit/{id}
|
||||
public IActionResult Edit(string id)
|
||||
{
|
||||
var set = _productAdapter.GetProductByData(id);
|
||||
if (set == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(set);
|
||||
}
|
||||
|
||||
// POST: /Product/Edit
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Edit(ProductBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_productAdapter.Update(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// GET: /Product/Delete/{id}
|
||||
public IActionResult Delete(string id)
|
||||
{
|
||||
var set = _productAdapter.GetProductByData(id);
|
||||
if (set == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(set);
|
||||
}
|
||||
|
||||
// POST: /Product/Delete
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult DeleteConfirmed(string id)
|
||||
{
|
||||
_productAdapter.Delete(id);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
|
||||
namespace YAPWebAPI.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
public class ProductOrderController : Controller
|
||||
{
|
||||
private readonly IProductOrderAdapter _adapter;
|
||||
|
||||
public ProductOrderController(IProductOrderAdapter adapter)
|
||||
{
|
||||
_adapter = adapter;
|
||||
}
|
||||
|
||||
// список всех заказов
|
||||
public IActionResult Index()
|
||||
{
|
||||
var orders = _adapter.GetList();
|
||||
return View(orders);
|
||||
}
|
||||
|
||||
// просмотр деталей
|
||||
public IActionResult Details(string id)
|
||||
{
|
||||
var order = _adapter.GetElement(id);
|
||||
if (order == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(order);
|
||||
}
|
||||
|
||||
// форма создания
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Create(ProductOrderBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_adapter.RegisterProductOrder(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// заказы за период
|
||||
public IActionResult ByPeriod(DateTime fromDate, DateTime toDate)
|
||||
{
|
||||
var orders = _adapter.GetListByPeriod(fromDate, toDate);
|
||||
return View("Index", orders); // можно отдельное представление
|
||||
}
|
||||
|
||||
// заказы по продукту за период
|
||||
public IActionResult ByProductAndPeriod(string productId, DateTime fromDate, DateTime toDate)
|
||||
{
|
||||
var orders = _adapter.GetListByProductAndPeriod(productId, fromDate, toDate);
|
||||
return View("Index", orders);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
|
||||
namespace YAPWebAPI.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
public class ProductSetController : Controller
|
||||
{
|
||||
private readonly IProductSetAdapter _productSetAdapter;
|
||||
|
||||
public ProductSetController(IProductSetAdapter productSetAdapter)
|
||||
{
|
||||
_productSetAdapter = productSetAdapter;
|
||||
}
|
||||
|
||||
// GET: /ProductSet/
|
||||
public IActionResult Index()
|
||||
{
|
||||
var sets = _productSetAdapter.GetList();
|
||||
return View(sets);
|
||||
}
|
||||
|
||||
// GET: /ProductSet/Details/{id}
|
||||
public IActionResult Details(string id)
|
||||
{
|
||||
var set = _productSetAdapter.GetProductSetByData(id);
|
||||
if (set == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(set);
|
||||
}
|
||||
|
||||
// GET: /ProductSet/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: /ProductSet/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Create(ProductSetBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_productSetAdapter.Insert(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// GET: /ProductSet/Edit/{id}
|
||||
public IActionResult Edit(string id)
|
||||
{
|
||||
var set = _productSetAdapter.GetProductSetByData(id);
|
||||
if (set == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(set);
|
||||
}
|
||||
|
||||
// POST: /ProductSet/Edit
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Edit(ProductSetBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_productSetAdapter.Update(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// GET: /ProductSet/Delete/{id}
|
||||
public IActionResult Delete(string id)
|
||||
{
|
||||
var set = _productSetAdapter.GetProductSetByData(id);
|
||||
if (set == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(set);
|
||||
}
|
||||
|
||||
// POST: /ProductSet/Delete
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult DeleteConfirmed(string id)
|
||||
{
|
||||
_productSetAdapter.Delete(id);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,74 +10,101 @@ using YAPContracts.ViewModels;
|
||||
namespace YAPWebAPI.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
public class PurchaseController(IPurchaseAdapter adapter) : ControllerBase
|
||||
public class PurchaseController : Controller
|
||||
{
|
||||
private readonly IPurchaseAdapter _adapter = adapter;
|
||||
private readonly IPurchaseAdapter _purchaseAdapter;
|
||||
|
||||
/// <summary>
|
||||
/// Получить все покупки
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
public IActionResult GetAll()
|
||||
public PurchaseController(IPurchaseAdapter purchaseAdapter)
|
||||
{
|
||||
return _adapter.GetList().GetResponse(Request, Response);
|
||||
_purchaseAdapter = purchaseAdapter;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получить покупку по Id
|
||||
/// </summary>
|
||||
[HttpGet("{id}")]
|
||||
public IActionResult GetById(string id)
|
||||
// список всех покупок
|
||||
public IActionResult Index()
|
||||
{
|
||||
return _adapter.GetElement(id).GetResponse(Request, Response);
|
||||
var purchases = _purchaseAdapter.GetList();
|
||||
return View(purchases);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получить покупки по пользователю за период
|
||||
/// </summary>
|
||||
[HttpGet("byUser/{userId}")]
|
||||
public IActionResult GetByUserAndPeriod(string userId, DateTime fromDate, DateTime toDate)
|
||||
// просмотр деталей
|
||||
public IActionResult Details(string id)
|
||||
{
|
||||
return _adapter.GetByUserAndPeriod(userId, fromDate, toDate).GetResponse(Request, Response);
|
||||
var purchase = _purchaseAdapter.GetElement(id);
|
||||
if (purchase == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(purchase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получить покупки за период
|
||||
/// </summary>
|
||||
[HttpGet("byPeriod")]
|
||||
public IActionResult GetByPeriod(DateTime fromDate, DateTime toDate)
|
||||
// форма добавления
|
||||
public IActionResult Create()
|
||||
{
|
||||
return _adapter.GetByPeriod(fromDate, toDate).GetResponse(Request, Response);
|
||||
return View();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавить покупку
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public IActionResult Create([FromBody] PurchaseBindingModel model)
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Create(PurchaseBindingModel model)
|
||||
{
|
||||
return _adapter.InsertPurchase(model).GetResponse(Request, Response);
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_purchaseAdapter.Register(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обновить покупку
|
||||
/// </summary>
|
||||
[HttpPut]
|
||||
public IActionResult Update([FromBody] PurchaseBindingModel model)
|
||||
// форма редактирования
|
||||
public IActionResult Edit(string id)
|
||||
{
|
||||
return _adapter.UpdatePurchase(model).GetResponse(Request, Response);
|
||||
var purchase = _purchaseAdapter.GetElement(id);
|
||||
if (purchase == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var bindingModel = new PurchaseBindingModel
|
||||
{
|
||||
Id = purchase.Id,
|
||||
UserId = purchase.UserId,
|
||||
PurchaseDate = purchase.PurchaseDate,
|
||||
TotalPrice = purchase.TotalPrice,
|
||||
// сюда можно маппить связанные продукты/сборки
|
||||
};
|
||||
|
||||
return View(bindingModel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удалить покупку
|
||||
/// </summary>
|
||||
[HttpDelete("{id}")]
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Edit(PurchaseBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_purchaseAdapter.Update(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// удаление
|
||||
public IActionResult Delete(string id)
|
||||
{
|
||||
return _adapter.DeletePurchase(id).GetResponse(Request, Response);
|
||||
var purchase = _purchaseAdapter.GetElement(id);
|
||||
if (purchase == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(purchase);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult DeleteConfirmed(string id)
|
||||
{
|
||||
_purchaseAdapter.Delete(id);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,31 +6,104 @@ using YAPContracts.BindingModels;
|
||||
namespace YAPWebAPI.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
public class StorekeeperController(IStorekeeperAdapter adapter) : ControllerBase
|
||||
public class StorekeeperController : Controller
|
||||
{
|
||||
private readonly IStorekeeperAdapter _adapter = adapter;
|
||||
private readonly IStorekeeperAdapter _storekeeperAdapter;
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult GetAllStorekeepers()
|
||||
=> _adapter.GetList().GetResponse(Request, Response);
|
||||
public StorekeeperController(IStorekeeperAdapter storekeeperAdapter)
|
||||
{
|
||||
_storekeeperAdapter = storekeeperAdapter;
|
||||
}
|
||||
|
||||
[HttpGet("{id}")]
|
||||
public IActionResult GetStorekeeper(string id)
|
||||
=> _adapter.GetElement(id).GetResponse(Request, Response);
|
||||
// список всех работников
|
||||
public IActionResult Index()
|
||||
{
|
||||
var storekeepers = _storekeeperAdapter.GetList();
|
||||
return View(storekeepers);
|
||||
}
|
||||
|
||||
// просмотр деталей конкретного работника
|
||||
public IActionResult Details(string id)
|
||||
{
|
||||
var storekeeper = _storekeeperAdapter.GetElement(id);
|
||||
if (storekeeper == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(storekeeper);
|
||||
}
|
||||
|
||||
// GET: форма создания
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: создание нового работника
|
||||
[HttpPost]
|
||||
public IActionResult Register([FromBody] StorekeeperBindingModel model)
|
||||
=> _adapter.Register(model).GetResponse(Request, Response);
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Create(StorekeeperBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_storekeeperAdapter.Register(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
public IActionResult Update([FromBody] StorekeeperBindingModel model)
|
||||
=> _adapter.Update(model).GetResponse(Request, Response);
|
||||
// GET: форма редактирования
|
||||
public IActionResult Edit(string id)
|
||||
{
|
||||
var storekeeper = _storekeeperAdapter.GetElement(id);
|
||||
if (storekeeper == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
// для редактирования можно заполнить BindingModel из ViewModel
|
||||
var bindingModel = new StorekeeperBindingModel
|
||||
{
|
||||
Id = storekeeper.Id,
|
||||
Login = storekeeper.Login,
|
||||
Email = storekeeper.Email,
|
||||
Password = "", // пароль редактируется отдельно
|
||||
};
|
||||
|
||||
return View(bindingModel);
|
||||
}
|
||||
|
||||
// POST: обновление данных
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Edit(StorekeeperBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_storekeeperAdapter.Update(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// GET: форма удаления
|
||||
public IActionResult Delete(string id)
|
||||
=> _adapter.Delete(id).GetResponse(Request, Response);
|
||||
{
|
||||
var storekeeper = _storekeeperAdapter.GetElement(id);
|
||||
if (storekeeper == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(storekeeper);
|
||||
}
|
||||
|
||||
// POST: подтверждение удаления
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult DeleteConfirmed(string id)
|
||||
{
|
||||
_storekeeperAdapter.Delete(id);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,32 +5,115 @@ using YAPContracts.BindingModels;
|
||||
|
||||
namespace YAPWebAPI.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
public class WorkerController(IWorkerAdapter adapter) : ControllerBase
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using YAPWebAPI.Adapters;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPWebUI.Controllers
|
||||
{
|
||||
private readonly IWorkerAdapter _adapter = adapter;
|
||||
[Authorize]
|
||||
public class WorkerController : Controller
|
||||
{
|
||||
private readonly IWorkerAdapter _workerAdapter;
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult GetAllWorkers()
|
||||
=> _adapter.GetList().GetResponse(Request, Response);
|
||||
public WorkerController(IWorkerAdapter workerAdapter)
|
||||
{
|
||||
_workerAdapter = workerAdapter;
|
||||
}
|
||||
|
||||
[HttpGet("{id}")]
|
||||
public IActionResult GetWorker(string id)
|
||||
=> _adapter.GetElement(id).GetResponse(Request, Response);
|
||||
// список всех работников
|
||||
public IActionResult Index()
|
||||
{
|
||||
var workers = _workerAdapter.GetList();
|
||||
return View(workers);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult Register([FromBody] WorkerBindingModel model)
|
||||
=> _adapter.Register(model).GetResponse(Request, Response);
|
||||
// просмотр деталей конкретного работника
|
||||
public IActionResult Details(string id)
|
||||
{
|
||||
var worker = _workerAdapter.GetElement(id);
|
||||
if (worker == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(worker);
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
public IActionResult Update([FromBody] WorkerBindingModel model)
|
||||
=> _adapter.Update(model).GetResponse(Request, Response);
|
||||
// GET: форма создания
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
public IActionResult Delete(string id)
|
||||
=> _adapter.Delete(id).GetResponse(Request, Response);
|
||||
// POST: создание нового работника
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Create(WorkerBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_workerAdapter.Register(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// GET: форма редактирования
|
||||
public IActionResult Edit(string id)
|
||||
{
|
||||
var worker = _workerAdapter.GetElement(id);
|
||||
if (worker == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
// для редактирования можно заполнить BindingModel из ViewModel
|
||||
var bindingModel = new WorkerBindingModel
|
||||
{
|
||||
Id = worker.Id,
|
||||
Login = worker.Login,
|
||||
Email = worker.Email,
|
||||
Password = "", // пароль редактируется отдельно
|
||||
};
|
||||
|
||||
return View(bindingModel);
|
||||
}
|
||||
|
||||
// POST: обновление данных
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Edit(WorkerBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_workerAdapter.Update(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// GET: форма удаления
|
||||
public IActionResult Delete(string id)
|
||||
{
|
||||
var worker = _workerAdapter.GetElement(id);
|
||||
if (worker == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(worker);
|
||||
}
|
||||
|
||||
// POST: подтверждение удаления
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult DeleteConfirmed(string id)
|
||||
{
|
||||
_workerAdapter.Delete(id);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
using AutoMapper;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.BusinessLogicContracts;
|
||||
using YAPContracts.DataModels;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPWebApplication.Adapters
|
||||
{
|
||||
public class CommentAdapter : ICommentAdapter
|
||||
{
|
||||
private readonly ICommentBusinessLogicContract _commentBL;
|
||||
private readonly ILogger _logger;
|
||||
private readonly Mapper _mapper;
|
||||
|
||||
public CommentAdapter(ICommentBusinessLogicContract commentBL, ILogger<CommentAdapter> logger)
|
||||
{
|
||||
_commentBL = commentBL;
|
||||
_logger = logger;
|
||||
|
||||
var config = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<CommentBindingModel, CommentDataModel>();
|
||||
cfg.CreateMap<CommentDataModel, CommentViewModel>();
|
||||
cfg.CreateMap<CommentViewModel, CommentDataModel>();
|
||||
});
|
||||
|
||||
_mapper = new Mapper(config);
|
||||
}
|
||||
|
||||
public List<CommentViewModel>? GetList()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _commentBL.GetAllComments()
|
||||
.Select(x => _mapper.Map<CommentViewModel>(x))
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in CommentAdapter.GetList");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public CommentViewModel? GetCommentById(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = _commentBL.GetCommentByData(id);
|
||||
return data != null ? _mapper.Map<CommentViewModel>(data) : null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in CommentAdapter.GetCommentById");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<CommentViewModel>? GetCommentsByProductSetAndPeriod(string productSetId, DateTime fromDate, DateTime toDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _commentBL.GetCommentsByProductSetByPeriod(productSetId, fromDate, toDate)
|
||||
.Select(x => _mapper.Map<CommentViewModel>(x))
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in CommentAdapter.GetCommentsByProductSetAndPeriod");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<CommentViewModel>? GetCommentsByUserAndPeriod(string userId, DateTime fromDate, DateTime toDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _commentBL.GetCommentsByUserByPeriod(userId, fromDate, toDate)
|
||||
.Select(x => _mapper.Map<CommentViewModel>(x))
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in CommentAdapter.GetCommentsByUserAndPeriod");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<CommentViewModel>? GetCommentsByPeriod(DateTime fromDate, DateTime toDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _commentBL.GetCommentsByPeriod(fromDate, toDate)
|
||||
.Select(x => _mapper.Map<CommentViewModel>(x))
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in CommentAdapter.GetCommentsByPeriod");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Create(CommentBindingModel comment)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = _mapper.Map<CommentDataModel>(comment);
|
||||
_commentBL.InsertComment(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in CommentAdapter.Create");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(CommentBindingModel comment)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = _mapper.Map<CommentDataModel>(comment);
|
||||
_commentBL.UpdateComment(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in CommentAdapter.Update");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_commentBL.DeleteComment(id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in CommentAdapter.Delete");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
using AutoMapper;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.BusinessLogicContracts;
|
||||
using YAPContracts.DataModels;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPWebApplication.Adapters
|
||||
{
|
||||
public class ComponentAdapter : IComponentAdapter
|
||||
{
|
||||
private readonly IComponentBusinessLogicContract _productBL;
|
||||
private readonly ILogger _logger;
|
||||
private readonly Mapper _mapper;
|
||||
|
||||
public ComponentAdapter(IComponentBusinessLogicContract productBL, ILogger<ComponentAdapter> logger)
|
||||
{
|
||||
_productBL = productBL;
|
||||
_logger = logger;
|
||||
|
||||
var config = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<ComponentBindingModel, ComponentDataModel>();
|
||||
cfg.CreateMap<ComponentDataModel, ComponentViewModel>();
|
||||
cfg.CreateMap<ComponentViewModel, ComponentDataModel>();
|
||||
});
|
||||
|
||||
_mapper = new Mapper(config);
|
||||
}
|
||||
|
||||
public List<ComponentViewModel>? GetList(bool onlyActual = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _productBL.GetAllComponents(onlyActual)
|
||||
.Select(x => _mapper.Map<ComponentViewModel>(x))
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ComponentAdapter.GetList");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public ComponentViewModel? GetComponentByData(string data)
|
||||
{
|
||||
try
|
||||
{
|
||||
var model = _productBL.GetComponentByData(data);
|
||||
return model != null ? _mapper.Map<ComponentViewModel>(model) : null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ComponentAdapter.GetComponentByData");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Insert(ComponentBindingModel product)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = _mapper.Map<ComponentDataModel>(product);
|
||||
_productBL.InsertComponent(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ComponentAdapter.Insert");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(ComponentBindingModel product)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = _mapper.Map<ComponentDataModel>(product);
|
||||
_productBL.UpdateComponent(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ComponentAdapter.Update");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_productBL.DeleteComponent(id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ComponentAdapter.Delete");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
using AutoMapper;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.BusinessLogicContracts;
|
||||
using YAPContracts.DataModels;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPWebApplication.Adapters
|
||||
{
|
||||
public class ProductAdapter : IProductAdapter
|
||||
{
|
||||
private readonly IProductBusinessLogicContract _productBL;
|
||||
private readonly ILogger _logger;
|
||||
private readonly Mapper _mapper;
|
||||
|
||||
public ProductAdapter(IProductBusinessLogicContract productBL, ILogger<ProductAdapter> logger)
|
||||
{
|
||||
_productBL = productBL;
|
||||
_logger = logger;
|
||||
|
||||
var config = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<ProductBindingModel, ProductDataModel>();
|
||||
cfg.CreateMap<ProductDataModel, ProductViewModel>();
|
||||
cfg.CreateMap<ProductViewModel, ProductDataModel>();
|
||||
});
|
||||
|
||||
_mapper = new Mapper(config);
|
||||
}
|
||||
|
||||
public List<ProductViewModel>? GetList(bool onlyActual = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _productBL.GetAllProducts(onlyActual)
|
||||
.Select(x => _mapper.Map<ProductViewModel>(x))
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductAdapter.GetList");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public ProductViewModel? GetProductByData(string data)
|
||||
{
|
||||
try
|
||||
{
|
||||
var model = _productBL.GetProductByData(data);
|
||||
return model != null ? _mapper.Map<ProductViewModel>(model) : null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductAdapter.GetProductByData");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Insert(ProductBindingModel product)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = _mapper.Map<ProductDataModel>(product);
|
||||
_productBL.InsertProduct(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductAdapter.Insert");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(ProductBindingModel product)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = _mapper.Map<ProductDataModel>(product);
|
||||
_productBL.UpdateProduct(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductAdapter.Update");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_productBL.DeleteProduct(id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductAdapter.Delete");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
using AutoMapper;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.BusinessLogicContracts;
|
||||
using YAPContracts.DataModels;
|
||||
using YAPContracts.Exceptions;
|
||||
using YAPContracts.ViewModels;
|
||||
using YAPDatabase.Models;
|
||||
|
||||
namespace YAPWebApplication.Adapters;
|
||||
|
||||
public class ProductOrderAdapter : IProductOrderAdapter
|
||||
{
|
||||
private readonly IProductOrderBusinessLogicContract _productOrderBL;
|
||||
private readonly ILogger _logger;
|
||||
private readonly Mapper _mapper;
|
||||
|
||||
public ProductOrderAdapter(IProductOrderBusinessLogicContract productOrderBL, ILogger logger)
|
||||
{
|
||||
_productOrderBL = productOrderBL;
|
||||
_logger = logger;
|
||||
|
||||
var config = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<ProductOrderBindingModel, ProductOrderDataModel>();
|
||||
cfg.CreateMap<ProductOrderDataModel, ProductOrderViewModel>();
|
||||
cfg.CreateMap<ProductOrderViewModel, ProductOrderDataModel>();
|
||||
});
|
||||
_mapper = new Mapper(config);
|
||||
}
|
||||
|
||||
public List<ProductOrderViewModel>? GetList()
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _productOrderBL.GetAllProductOrders();
|
||||
return list?.Select(x => _mapper.Map<ProductOrderViewModel>(x)).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductOrder GetList");
|
||||
throw new Exception("Error retrieving ProductOrders", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public List<ProductOrderViewModel>? GetListByPeriod(DateTime fromDate, DateTime toDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _productOrderBL.GetProductOrdersByPeriod(fromDate, toDate);
|
||||
return list?.Select(x => _mapper.Map<ProductOrderViewModel>(x)).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductOrder GetListByPeriod");
|
||||
throw new Exception("Error retrieving ProductOrders by period", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public List<ProductOrderViewModel>? GetListByProductAndPeriod(string productId, DateTime fromDate, DateTime toDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _productOrderBL.GetProductOrdersByProductByPeriod(productId, fromDate, toDate);
|
||||
return list?.Select(x => _mapper.Map<ProductOrderViewModel>(x)).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductOrder GetListByProductAndPeriod");
|
||||
throw new Exception("Error retrieving ProductOrders by product and period", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public ProductOrderViewModel? GetElement(string data)
|
||||
{
|
||||
try
|
||||
{
|
||||
var order = _productOrderBL.GetProductOrderByData(data);
|
||||
return order != null ? _mapper.Map<ProductOrderViewModel>(order) : null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductOrder GetElement");
|
||||
throw new Exception("Error retrieving ProductOrder", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterProductOrder(ProductOrderBindingModel productOrderModel)
|
||||
{
|
||||
try
|
||||
{
|
||||
var dataModel = _mapper.Map<ProductOrderDataModel>(productOrderModel);
|
||||
_productOrderBL.InsertProductOrder(dataModel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductOrder Register");
|
||||
throw new Exception("Error registering ProductOrder", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
using AutoMapper;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.BusinessLogicContracts;
|
||||
using YAPContracts.DataModels;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPWebApplication.Adapters
|
||||
{
|
||||
public class ProductSetAdapter : IProductSetAdapter
|
||||
{
|
||||
private readonly IProductSetBusinessLogicContract _productSetBL;
|
||||
private readonly ILogger _logger;
|
||||
private readonly Mapper _mapper;
|
||||
|
||||
public ProductSetAdapter(IProductSetBusinessLogicContract productSetBL, ILogger<ProductSetAdapter> logger)
|
||||
{
|
||||
_productSetBL = productSetBL;
|
||||
_logger = logger;
|
||||
|
||||
var config = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<ProductSetBindingModel, ProductSetDataModel>();
|
||||
cfg.CreateMap<ProductSetDataModel, ProductSetViewModel>();
|
||||
cfg.CreateMap<ProductSetViewModel, ProductSetDataModel>();
|
||||
});
|
||||
|
||||
_mapper = new Mapper(config);
|
||||
}
|
||||
|
||||
public List<ProductSetViewModel>? GetList()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _productSetBL.GetAllProductSets()
|
||||
.Select(x => _mapper.Map<ProductSetViewModel>(x))
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductSetAdapter.GetList");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public ProductSetViewModel? GetProductSetByData(string data)
|
||||
{
|
||||
try
|
||||
{
|
||||
var model = _productSetBL.GetProductSetByData(data);
|
||||
return model != null ? _mapper.Map<ProductSetViewModel>(model) : null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductSetAdapter.GetProductSetByData");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Insert(ProductSetBindingModel productSet)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = _mapper.Map<ProductSetDataModel>(productSet);
|
||||
_productSetBL.InsertProductSet(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductSetAdapter.Insert");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(ProductSetBindingModel productSet)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = _mapper.Map<ProductSetDataModel>(productSet);
|
||||
_productSetBL.UpdateProductSet(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductSetAdapter.Update");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_productSetBL.DeleteProductSet(id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ProductSetAdapter.Delete");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.DataModels;
|
||||
using YAPContracts.ViewModels;
|
||||
using YAPContracts.BusinessLogicContracts;
|
||||
using YAPContracts.Exceptions;
|
||||
using YAPContracts.AdapterContracts;
|
||||
|
||||
namespace YAPWebApplication.Adapters
|
||||
{
|
||||
public class PurchaseAdapter : IPurchaseAdapter
|
||||
{
|
||||
private readonly IPurchaseBusinessLogicContract _purchaseBL;
|
||||
private readonly ILogger _logger;
|
||||
private readonly Mapper _mapper;
|
||||
public PurchaseAdapter(IPurchaseBusinessLogicContract purchaseBL, ILogger logger)
|
||||
{
|
||||
_purchaseBL = purchaseBL;
|
||||
_logger = logger;
|
||||
|
||||
var config = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<PurchaseBindingModel, PurchaseDataModel>();
|
||||
cfg.CreateMap<PurchaseDataModel, PurchaseViewModel>();
|
||||
cfg.CreateMap<PurchaseViewModel, PurchaseDataModel>();
|
||||
});
|
||||
_mapper = new Mapper(config);
|
||||
}
|
||||
|
||||
public List<PurchaseViewModel> GetList()
|
||||
{
|
||||
try
|
||||
{
|
||||
var purchases = _purchaseBL.GetAllPurchases();
|
||||
return purchases.Select(x => _mapper.Map<PurchaseViewModel>(x)).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Purchase GetList");
|
||||
throw new Exception("Error retrieving purchases list", ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public PurchaseViewModel? GetElement(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var purchase = _purchaseBL.GetPurchaseByData(id);
|
||||
return purchase != null ? _mapper.Map<PurchaseViewModel>(purchase) : null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Purchase GetElement");
|
||||
throw new Exception("Error retrieving purchase", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void Register(PurchaseBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var dataModel = _mapper.Map<PurchaseDataModel>(model);
|
||||
_purchaseBL.InsertPurchase(dataModel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Purchase Register");
|
||||
throw new Exception("Error creating purchase", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(PurchaseBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var dataModel = _mapper.Map<PurchaseDataModel>(model);
|
||||
_purchaseBL.UpdatePurchase(dataModel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Purchase Update");
|
||||
throw new Exception("Error updating purchase", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_purchaseBL.DeletePurchase(id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Purchase Delete");
|
||||
throw new Exception("Error deleting purchase", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public List<PurchaseViewModel> GetByUserAndPeriod(string userId, DateTime fromDate, DateTime toDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
var purchases = _purchaseBL.GetPurchasesByUserByPeriod(userId, fromDate, toDate);
|
||||
return purchases.Select(x => _mapper.Map<PurchaseViewModel>(x)).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Purchase GetByUserAndPeriod");
|
||||
throw new Exception("Error retrieving purchases list by user and period", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public List<PurchaseViewModel> GetByPeriod(DateTime fromDate, DateTime toDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
var purchases = _purchaseBL.GetPurchasesByPeriod(fromDate, toDate);
|
||||
return purchases.Select(x => _mapper.Map<PurchaseViewModel>(x)).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Purchase GetByPeriod");
|
||||
throw new Exception("Error retrieving purchases list by period", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
using AutoMapper;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.BusinessLogicContracts;
|
||||
using YAPContracts.DataModels.UserRoles;
|
||||
using YAPContracts.Extentions;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPWebApplication.Adapters
|
||||
{
|
||||
public class StorekeeperAdapter : IStorekeeperAdapter
|
||||
{
|
||||
private readonly IStorekeeperBusinessLogicContract _storekeeperBusinessLogic;
|
||||
private readonly ILogger _logger;
|
||||
private readonly Mapper _mapper;
|
||||
|
||||
public StorekeeperAdapter(IStorekeeperBusinessLogicContract storekeeperBusinessLogic, ILogger logger)
|
||||
{
|
||||
_storekeeperBusinessLogic = storekeeperBusinessLogic;
|
||||
_logger = logger;
|
||||
|
||||
var config = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<StorekeeperBindingModel, StorekeeperDataModel>();
|
||||
cfg.CreateMap<StorekeeperDataModel, StorekeeperViewModel>();
|
||||
cfg.CreateMap<StorekeeperViewModel, StorekeeperDataModel>();
|
||||
});
|
||||
_mapper = new Mapper(config);
|
||||
}
|
||||
|
||||
public List<StorekeeperViewModel> GetList()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _storekeeperBusinessLogic.GetAllStorekeepers()
|
||||
.Select(x => _mapper.Map<StorekeeperViewModel>(x)).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Handle exceptions as needed, e.g., log them or rethrow
|
||||
_logger.LogError(ex, "Error in Storekeeper GetList");
|
||||
throw new Exception("Error retrieving users list", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public StorekeeperViewModel? GetElement(string data)
|
||||
{
|
||||
try
|
||||
{
|
||||
var dataModel = _storekeeperBusinessLogic.GetStorekeeperByData(data);
|
||||
return dataModel != null ? _mapper.Map<StorekeeperViewModel>(dataModel) : null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Storekeeper GetElement");
|
||||
throw new Exception($"Error retrieving user with data {data}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void Register(StorekeeperBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model), "User data model cannot be null");
|
||||
}
|
||||
var dataModel = _mapper.Map<StorekeeperDataModel>(model);
|
||||
_storekeeperBusinessLogic.InsertStorekeeper(dataModel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Storekeeper Register");
|
||||
throw new Exception("Error adding user data model", ex);
|
||||
}
|
||||
}
|
||||
public void Update(StorekeeperBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model), "User data model cannot be null");
|
||||
}
|
||||
var dataModel = _mapper.Map<StorekeeperDataModel>(model);
|
||||
_storekeeperBusinessLogic.UpdateStorekeeper(dataModel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Storekeeper Update");
|
||||
throw new Exception("Error adding user data model", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!id.IsGuid()) throw new ArgumentException(nameof(id), "Incorrect Id");
|
||||
_storekeeperBusinessLogic.DeleteStorekeeper(id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Handle exceptions as needed, e.g., log them or rethrow
|
||||
_logger.LogError(ex, "Error in Storekeeper Delete");
|
||||
throw new Exception($"Error deleting purchase with ID {id}", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
112
YouAreProgrammerShop/YAPWebApplication/Adapters/WorkerAdapter.cs
Normal file
112
YouAreProgrammerShop/YAPWebApplication/Adapters/WorkerAdapter.cs
Normal file
@@ -0,0 +1,112 @@
|
||||
using AutoMapper;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.BusinessLogicContracts;
|
||||
using YAPContracts.DataModels;
|
||||
using YAPContracts.DataModels.UserRoles;
|
||||
using YAPContracts.Extentions;
|
||||
using YAPContracts.ViewModels;
|
||||
using YAPDatabase.Models;
|
||||
|
||||
namespace YAPWebApplication.Adapters
|
||||
{
|
||||
public class WorkerAdapter : IWorkerAdapter
|
||||
{
|
||||
private readonly IWorkerBusinessLogicContract _workerBL;
|
||||
private readonly ILogger _logger;
|
||||
private readonly Mapper _mapper;
|
||||
|
||||
public WorkerAdapter(IWorkerBusinessLogicContract workerBL, ILogger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_workerBL = workerBL;
|
||||
var config = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<WorkerBindingModel, WorkerDataModel>();
|
||||
cfg.CreateMap<WorkerDataModel, WorkerViewModel>();
|
||||
cfg.CreateMap<WorkerViewModel, WorkerDataModel>();
|
||||
});
|
||||
_mapper = new Mapper(config);
|
||||
|
||||
}
|
||||
|
||||
public List<WorkerViewModel> GetList()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _workerBL.GetAllWorkers()
|
||||
.Select(x => _mapper.Map<WorkerViewModel>(x)).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Handle exceptions as needed, e.g., log them or rethrow
|
||||
_logger.LogError(ex, "Error in Worker GetList");
|
||||
throw new Exception("Error retrieving users list", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public WorkerViewModel? GetElement(string data)
|
||||
{
|
||||
try
|
||||
{
|
||||
var dataModel = _workerBL.GetWorkerByData(data);
|
||||
return dataModel != null ? _mapper.Map<WorkerViewModel>(dataModel) : null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Worker GetElement");
|
||||
throw new Exception($"Error retrieving user with data {data}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void Register(WorkerBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model), "User data model cannot be null");
|
||||
}
|
||||
var dataModel = _mapper.Map<WorkerDataModel>(model);
|
||||
_workerBL.InsertWorker(dataModel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Worker Register");
|
||||
throw new Exception("Error adding user data model", ex);
|
||||
}
|
||||
}
|
||||
public void Update(WorkerBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model), "User data model cannot be null");
|
||||
}
|
||||
var dataModel = _mapper.Map<WorkerDataModel>(model);
|
||||
_workerBL.UpdateWorker(dataModel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in Worker Update");
|
||||
throw new Exception("Error adding user data model", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!id.IsGuid()) throw new ArgumentException(nameof(id), "Incorrect Id");
|
||||
_workerBL.DeleteWorker(id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Handle exceptions as needed, e.g., log them or rethrow
|
||||
_logger.LogError(ex, "Error in Worker Delete");
|
||||
throw new Exception($"Error deleting purchase with ID {id}", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
YouAreProgrammerShop/YAPWebApplication/AuthOptions.cs
Normal file
13
YouAreProgrammerShop/YAPWebApplication/AuthOptions.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using System.Text;
|
||||
|
||||
namespace YAPWebApplication
|
||||
{
|
||||
public class AuthOptions
|
||||
{
|
||||
public const string ISSUER = "YAP_AuthServer"; // издатель токена
|
||||
public const string AUDIENCE = "YAP_AuthClient"; // потребитель токена
|
||||
const string KEY = "yapsecret_secretsecretsecretkey!123"; // ключ для шифрования
|
||||
public static SymmetricSecurityKey GetSymmetricSecurityKey() => new(Encoding.UTF8.GetBytes(KEY));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
|
||||
namespace YAPWebApplication.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
public class CommentController : Controller
|
||||
{
|
||||
private readonly ICommentAdapter _commentAdapter;
|
||||
|
||||
public CommentController(ICommentAdapter commentAdapter)
|
||||
{
|
||||
_commentAdapter = commentAdapter;
|
||||
}
|
||||
|
||||
// GET: /Comment/
|
||||
public IActionResult Index()
|
||||
{
|
||||
var comments = _commentAdapter.GetList();
|
||||
return View(comments);
|
||||
}
|
||||
|
||||
// GET: /Comment/Details/{id}
|
||||
public IActionResult Details(string id)
|
||||
{
|
||||
var comment = _commentAdapter.GetCommentById(id);
|
||||
if (comment == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(comment);
|
||||
}
|
||||
|
||||
// GET: /Comment/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: /Comment/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Create(CommentBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_commentAdapter.Create(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// GET: /Comment/Edit/{id}
|
||||
public IActionResult Edit(string id)
|
||||
{
|
||||
var comment = _commentAdapter.GetCommentById(id);
|
||||
if (comment == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(comment);
|
||||
}
|
||||
|
||||
// POST: /Comment/Edit
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Edit(CommentBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_commentAdapter.Update(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// GET: /Comment/Delete/{id}
|
||||
public IActionResult Delete(string id)
|
||||
{
|
||||
var comment = _commentAdapter.GetCommentById(id);
|
||||
if (comment == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(comment);
|
||||
}
|
||||
|
||||
// POST: /Comment/Delete
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult DeleteConfirmed(string id)
|
||||
{
|
||||
_commentAdapter.Delete(id);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
|
||||
namespace YAPWebApplication.Controllers
|
||||
{
|
||||
public class ProductController : Controller
|
||||
{
|
||||
private readonly IProductAdapter _productAdapter;
|
||||
|
||||
public ProductController(IProductAdapter productAdapter)
|
||||
{
|
||||
_productAdapter = productAdapter;
|
||||
}
|
||||
|
||||
// GET: /Product/
|
||||
public IActionResult Index()
|
||||
{
|
||||
var sets = _productAdapter.GetList();
|
||||
return View(sets);
|
||||
}
|
||||
|
||||
// GET: /Product/Details/{id}
|
||||
public IActionResult Details(string id)
|
||||
{
|
||||
var set = _productAdapter.GetProductByData(id);
|
||||
if (set == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(set);
|
||||
}
|
||||
|
||||
// GET: /Product/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: /Product/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Create(ProductBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_productAdapter.Insert(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// GET: /Product/Edit/{id}
|
||||
public IActionResult Edit(string id)
|
||||
{
|
||||
var set = _productAdapter.GetProductByData(id);
|
||||
if (set == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(set);
|
||||
}
|
||||
|
||||
// POST: /Product/Edit
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Edit(ProductBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_productAdapter.Update(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// GET: /Product/Delete/{id}
|
||||
public IActionResult Delete(string id)
|
||||
{
|
||||
var set = _productAdapter.GetProductByData(id);
|
||||
if (set == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(set);
|
||||
}
|
||||
|
||||
// POST: /Product/Delete
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult DeleteConfirmed(string id)
|
||||
{
|
||||
_productAdapter.Delete(id);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
|
||||
namespace YAPWebApplication.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
public class ProductOrderController : Controller
|
||||
{
|
||||
private readonly IProductOrderAdapter _adapter;
|
||||
|
||||
public ProductOrderController(IProductOrderAdapter adapter)
|
||||
{
|
||||
_adapter = adapter;
|
||||
}
|
||||
|
||||
// список всех заказов
|
||||
public IActionResult Index()
|
||||
{
|
||||
var orders = _adapter.GetList();
|
||||
return View(orders);
|
||||
}
|
||||
|
||||
// просмотр деталей
|
||||
public IActionResult Details(string id)
|
||||
{
|
||||
var order = _adapter.GetElement(id);
|
||||
if (order == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(order);
|
||||
}
|
||||
|
||||
// форма создания
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Create(ProductOrderBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_adapter.RegisterProductOrder(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// заказы за период
|
||||
public IActionResult ByPeriod(DateTime fromDate, DateTime toDate)
|
||||
{
|
||||
var orders = _adapter.GetListByPeriod(fromDate, toDate);
|
||||
return View("Index", orders); // можно отдельное представление
|
||||
}
|
||||
|
||||
// заказы по продукту за период
|
||||
public IActionResult ByProductAndPeriod(string productId, DateTime fromDate, DateTime toDate)
|
||||
{
|
||||
var orders = _adapter.GetListByProductAndPeriod(productId, fromDate, toDate);
|
||||
return View("Index", orders);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
|
||||
namespace YAPWebApplication.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
public class ProductSetController : Controller
|
||||
{
|
||||
private readonly IProductSetAdapter _productSetAdapter;
|
||||
|
||||
public ProductSetController(IProductSetAdapter productSetAdapter)
|
||||
{
|
||||
_productSetAdapter = productSetAdapter;
|
||||
}
|
||||
|
||||
// GET: /ProductSet/
|
||||
public IActionResult Index()
|
||||
{
|
||||
var sets = _productSetAdapter.GetList();
|
||||
return View(sets);
|
||||
}
|
||||
|
||||
// GET: /ProductSet/Details/{id}
|
||||
public IActionResult Details(string id)
|
||||
{
|
||||
var set = _productSetAdapter.GetProductSetByData(id);
|
||||
if (set == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(set);
|
||||
}
|
||||
|
||||
// GET: /ProductSet/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: /ProductSet/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Create(ProductSetBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_productSetAdapter.Insert(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// GET: /ProductSet/Edit/{id}
|
||||
public IActionResult Edit(string id)
|
||||
{
|
||||
var set = _productSetAdapter.GetProductSetByData(id);
|
||||
if (set == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(set);
|
||||
}
|
||||
|
||||
// POST: /ProductSet/Edit
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Edit(ProductSetBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_productSetAdapter.Update(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// GET: /ProductSet/Delete/{id}
|
||||
public IActionResult Delete(string id)
|
||||
{
|
||||
var set = _productSetAdapter.GetProductSetByData(id);
|
||||
if (set == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(set);
|
||||
}
|
||||
|
||||
// POST: /ProductSet/Delete
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult DeleteConfirmed(string id)
|
||||
{
|
||||
_productSetAdapter.Delete(id);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
using YAPContracts.BusinessLogicContracts;
|
||||
using YAPContracts.DataModels;
|
||||
using YAPContracts.ViewModels;
|
||||
|
||||
namespace YAPWebApplication.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
public class PurchaseController : Controller
|
||||
{
|
||||
private readonly IPurchaseAdapter _purchaseAdapter;
|
||||
|
||||
public PurchaseController(IPurchaseAdapter purchaseAdapter)
|
||||
{
|
||||
_purchaseAdapter = purchaseAdapter;
|
||||
}
|
||||
|
||||
// список всех покупок
|
||||
public IActionResult Index()
|
||||
{
|
||||
var purchases = _purchaseAdapter.GetList();
|
||||
return View(purchases);
|
||||
}
|
||||
|
||||
// просмотр деталей
|
||||
public IActionResult Details(string id)
|
||||
{
|
||||
var purchase = _purchaseAdapter.GetElement(id);
|
||||
if (purchase == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(purchase);
|
||||
}
|
||||
|
||||
// форма добавления
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Create(PurchaseBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_purchaseAdapter.Register(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// форма редактирования
|
||||
public IActionResult Edit(string id)
|
||||
{
|
||||
var purchase = _purchaseAdapter.GetElement(id);
|
||||
if (purchase == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var bindingModel = new PurchaseBindingModel
|
||||
{
|
||||
Id = purchase.Id,
|
||||
UserId = purchase.UserId,
|
||||
PurchaseDate = purchase.PurchaseDate,
|
||||
TotalPrice = purchase.TotalPrice,
|
||||
// сюда можно маппить связанные продукты/сборки
|
||||
};
|
||||
|
||||
return View(bindingModel);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Edit(PurchaseBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_purchaseAdapter.Update(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// удаление
|
||||
public IActionResult Delete(string id)
|
||||
{
|
||||
var purchase = _purchaseAdapter.GetElement(id);
|
||||
if (purchase == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(purchase);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult DeleteConfirmed(string id)
|
||||
{
|
||||
_purchaseAdapter.Delete(id);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
|
||||
namespace YAPWebApplication.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
public class StorekeeperController : Controller
|
||||
{
|
||||
private readonly IStorekeeperAdapter _storekeeperAdapter;
|
||||
|
||||
public StorekeeperController(IStorekeeperAdapter storekeeperAdapter)
|
||||
{
|
||||
_storekeeperAdapter = storekeeperAdapter;
|
||||
}
|
||||
|
||||
// список всех работников
|
||||
public IActionResult Index()
|
||||
{
|
||||
var storekeepers = _storekeeperAdapter.GetList();
|
||||
return View(storekeepers);
|
||||
}
|
||||
|
||||
// просмотр деталей конкретного работника
|
||||
public IActionResult Details(string id)
|
||||
{
|
||||
var storekeeper = _storekeeperAdapter.GetElement(id);
|
||||
if (storekeeper == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(storekeeper);
|
||||
}
|
||||
|
||||
// GET: форма создания
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: создание нового работника
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Create(StorekeeperBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_storekeeperAdapter.Register(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// GET: форма редактирования
|
||||
public IActionResult Edit(string id)
|
||||
{
|
||||
var storekeeper = _storekeeperAdapter.GetElement(id);
|
||||
if (storekeeper == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
// для редактирования можно заполнить BindingModel из ViewModel
|
||||
var bindingModel = new StorekeeperBindingModel
|
||||
{
|
||||
Id = storekeeper.Id,
|
||||
Login = storekeeper.Login,
|
||||
Email = storekeeper.Email,
|
||||
Password = "", // пароль редактируется отдельно
|
||||
};
|
||||
|
||||
return View(bindingModel);
|
||||
}
|
||||
|
||||
// POST: обновление данных
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Edit(StorekeeperBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_storekeeperAdapter.Update(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// GET: форма удаления
|
||||
public IActionResult Delete(string id)
|
||||
{
|
||||
var storekeeper = _storekeeperAdapter.GetElement(id);
|
||||
if (storekeeper == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(storekeeper);
|
||||
}
|
||||
|
||||
// POST: подтверждение удаления
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult DeleteConfirmed(string id)
|
||||
{
|
||||
_storekeeperAdapter.Delete(id);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using YAPContracts.AdapterContracts;
|
||||
using YAPContracts.BindingModels;
|
||||
|
||||
namespace YAPWebApplication.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
public class WorkerController : Controller
|
||||
{
|
||||
private readonly IWorkerAdapter _workerAdapter;
|
||||
|
||||
public WorkerController(IWorkerAdapter workerAdapter)
|
||||
{
|
||||
_workerAdapter = workerAdapter;
|
||||
}
|
||||
|
||||
// список всех работников
|
||||
public IActionResult Index()
|
||||
{
|
||||
var workers = _workerAdapter.GetList();
|
||||
return View(workers);
|
||||
}
|
||||
|
||||
// просмотр деталей конкретного работника
|
||||
public IActionResult Details(string id)
|
||||
{
|
||||
var worker = _workerAdapter.GetElement(id);
|
||||
if (worker == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(worker);
|
||||
}
|
||||
|
||||
// GET: форма создания
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: создание нового работника
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Create(WorkerBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_workerAdapter.Register(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// GET: форма редактирования
|
||||
public IActionResult Edit(string id)
|
||||
{
|
||||
var worker = _workerAdapter.GetElement(id);
|
||||
if (worker == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
// для редактирования можно заполнить BindingModel из ViewModel
|
||||
var bindingModel = new WorkerBindingModel
|
||||
{
|
||||
Id = worker.Id,
|
||||
Login = worker.Login,
|
||||
Email = worker.Email,
|
||||
Password = "", // пароль редактируется отдельно
|
||||
};
|
||||
|
||||
return View(bindingModel);
|
||||
}
|
||||
|
||||
// POST: обновление данных
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Edit(WorkerBindingModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_workerAdapter.Update(model);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// GET: форма удаления
|
||||
public IActionResult Delete(string id)
|
||||
{
|
||||
var worker = _workerAdapter.GetElement(id);
|
||||
if (worker == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(worker);
|
||||
}
|
||||
|
||||
// POST: подтверждение удаления
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult DeleteConfirmed(string id)
|
||||
{
|
||||
_workerAdapter.Delete(id);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
}
|
||||
}
|
||||
26
YouAreProgrammerShop/YAPWebApplication/Pages/Error.cshtml
Normal file
26
YouAreProgrammerShop/YAPWebApplication/Pages/Error.cshtml
Normal file
@@ -0,0 +1,26 @@
|
||||
@page
|
||||
@model ErrorModel
|
||||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
||||
28
YouAreProgrammerShop/YAPWebApplication/Pages/Error.cshtml.cs
Normal file
28
YouAreProgrammerShop/YAPWebApplication/Pages/Error.cshtml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace YAPWebApplication.Pages
|
||||
{
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
[IgnoreAntiforgeryToken]
|
||||
public class ErrorModel : PageModel
|
||||
{
|
||||
public string? RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
|
||||
private readonly ILogger<ErrorModel> _logger;
|
||||
|
||||
public ErrorModel(ILogger<ErrorModel> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
10
YouAreProgrammerShop/YAPWebApplication/Pages/Index.cshtml
Normal file
10
YouAreProgrammerShop/YAPWebApplication/Pages/Index.cshtml
Normal file
@@ -0,0 +1,10 @@
|
||||
@page
|
||||
@model IndexModel
|
||||
@{
|
||||
ViewData["Title"] = "Home page";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Welcome</h1>
|
||||
<p>Learn about <a href="https://learn.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
||||
</div>
|
||||
20
YouAreProgrammerShop/YAPWebApplication/Pages/Index.cshtml.cs
Normal file
20
YouAreProgrammerShop/YAPWebApplication/Pages/Index.cshtml.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace YAPWebApplication.Pages
|
||||
{
|
||||
public class IndexModel : PageModel
|
||||
{
|
||||
private readonly ILogger<IndexModel> _logger;
|
||||
|
||||
public IndexModel(ILogger<IndexModel> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
@page
|
||||
@model PrivacyModel
|
||||
@{
|
||||
ViewData["Title"] = "Privacy Policy";
|
||||
}
|
||||
<h1>@ViewData["Title"]</h1>
|
||||
|
||||
<p>Use this page to detail your site's privacy policy.</p>
|
||||
@@ -0,0 +1,20 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace YAPWebApplication.Pages
|
||||
{
|
||||
public class PrivacyModel : PageModel
|
||||
{
|
||||
private readonly ILogger<PrivacyModel> _logger;
|
||||
|
||||
public PrivacyModel(ILogger<PrivacyModel> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - YAPWebApplication</title>
|
||||
<script type="importmap"></script>
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/YAPWebApplication.styles.css" asp-append-version="true" />
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" asp-area="" asp-page="/Index">YAPWebApplication</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-page="/Index">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-page="/Privacy">Privacy</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="container">
|
||||
<main role="main" class="pb-3">
|
||||
@RenderBody()
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2025 - YAPWebApplication - <a asp-area="" asp-page="/Privacy">Privacy</a>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
|
||||
@await RenderSectionAsync("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,48 @@
|
||||
/* Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||
for details on configuring this project to bundle and minify static web assets. */
|
||||
|
||||
a.navbar-brand {
|
||||
white-space: normal;
|
||||
text-align: center;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0077cc;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.border-top {
|
||||
border-top: 1px solid #e5e5e5;
|
||||
}
|
||||
.border-bottom {
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
}
|
||||
|
||||
.box-shadow {
|
||||
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
|
||||
}
|
||||
|
||||
button.accept-policy {
|
||||
font-size: 1rem;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
line-height: 60px;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/dist/jquery.validate.unobtrusive.min.js"></script>
|
||||
@@ -0,0 +1,3 @@
|
||||
@using YAPWebApplication
|
||||
@namespace YAPWebApplication.Pages
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@@ -0,0 +1,3 @@
|
||||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
||||
96
YouAreProgrammerShop/YAPWebApplication/Program.cs
Normal file
96
YouAreProgrammerShop/YAPWebApplication/Program.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Security.Claims;
|
||||
using YAPDatabase;
|
||||
using YAPWebApplication;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddRazorPages();
|
||||
builder.Services.AddControllers();
|
||||
|
||||
builder.Services.AddAuthorization();
|
||||
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
||||
.AddJwtBearer(options =>
|
||||
{
|
||||
options.TokenValidationParameters = new TokenValidationParameters
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ValidateIssuer = true,
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ValidIssuer = AuthOptions.ISSUER,
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ValidateAudience = true,
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ValidAudience = AuthOptions.AUDIENCE,
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ValidateLifetime = true,
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
IssuerSigningKey = AuthOptions.GetSymmetricSecurityKey(),
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ValidateIssuerSigningKey = true,
|
||||
};
|
||||
// <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
options.Events = new JwtBearerEvents
|
||||
{
|
||||
OnAuthenticationFailed = context =>
|
||||
{
|
||||
Console.WriteLine("KEY BYTES (VALIDATE): " + string.Join(",", AuthOptions.GetSymmetricSecurityKey().Key));
|
||||
Console.WriteLine("JWT Error: " + context.Exception.Message);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
||||
builder.Services.AddOpenApi();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Error");
|
||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
if (app.Environment.IsProduction())
|
||||
{
|
||||
var dbContext = app.Services.GetRequiredService<YAPDbContext>();
|
||||
if (dbContext.Database.CanConnect())
|
||||
{
|
||||
dbContext.Database.EnsureCreated();
|
||||
dbContext.Database.Migrate();
|
||||
}
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthorization();
|
||||
app.UseAuthentication();
|
||||
|
||||
app.Map("/login/{username}", (string username) =>
|
||||
{
|
||||
Console.WriteLine("KEY BYTES (CREATE): " + string.Join(",", AuthOptions.GetSymmetricSecurityKey().Key));
|
||||
return new JwtSecurityTokenHandler().WriteToken(new JwtSecurityToken(
|
||||
issuer: AuthOptions.ISSUER,
|
||||
audience: AuthOptions.AUDIENCE,
|
||||
claims: [new(ClaimTypes.Name, username)],
|
||||
expires: DateTime.UtcNow.Add(TimeSpan.FromMinutes(2)),
|
||||
signingCredentials: new SigningCredentials(AuthOptions.GetSymmetricSecurityKey(), SecurityAlgorithms.HmacSha256)));
|
||||
});
|
||||
app.MapControllers();
|
||||
|
||||
app.MapStaticAssets();
|
||||
app.MapRazorPages()
|
||||
.WithStaticAssets();
|
||||
|
||||
app.Run();
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "http://localhost:5212",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:7275;http://localhost:5212",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.8" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.5" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\YAPBusinessLogic\YAPBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\YAPContracts\YAPContracts.csproj" />
|
||||
<ProjectReference Include="..\YAPDatabase\YAPDatabase.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"DetailedErrors": true,
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
9
YouAreProgrammerShop/YAPWebApplication/appsettings.json
Normal file
9
YouAreProgrammerShop/YAPWebApplication/appsettings.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
31
YouAreProgrammerShop/YAPWebApplication/wwwroot/css/site.css
Normal file
31
YouAreProgrammerShop/YAPWebApplication/wwwroot/css/site.css
Normal file
@@ -0,0 +1,31 @@
|
||||
html {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
html {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
|
||||
box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
|
||||
}
|
||||
|
||||
html {
|
||||
position: relative;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
|
||||
.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
|
||||
color: var(--bs-secondary-color);
|
||||
text-align: end;
|
||||
}
|
||||
|
||||
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
|
||||
text-align: start;
|
||||
}
|
||||
BIN
YouAreProgrammerShop/YAPWebApplication/wwwroot/favicon.ico
Normal file
BIN
YouAreProgrammerShop/YAPWebApplication/wwwroot/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
@@ -0,0 +1,4 @@
|
||||
// Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||
// for details on configuring this project to bundle and minify static web assets.
|
||||
|
||||
// Write your JavaScript code.
|
||||
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2011-2021 Twitter, Inc.
|
||||
Copyright (c) 2011-2021 The Bootstrap Authors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
4085
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css
vendored
Normal file
4085
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css.map
vendored
Normal file
1
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css.map
vendored
Normal file
File diff suppressed because one or more lines are too long
6
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css
vendored
Normal file
6
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4084
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.rtl.css
vendored
Normal file
4084
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.rtl.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
597
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css
vendored
Normal file
597
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css
vendored
Normal file
@@ -0,0 +1,597 @@
|
||||
/*!
|
||||
* Bootstrap Reboot v5.3.3 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2024 The Bootstrap Authors
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
:root,
|
||||
[data-bs-theme=light] {
|
||||
--bs-blue: #0d6efd;
|
||||
--bs-indigo: #6610f2;
|
||||
--bs-purple: #6f42c1;
|
||||
--bs-pink: #d63384;
|
||||
--bs-red: #dc3545;
|
||||
--bs-orange: #fd7e14;
|
||||
--bs-yellow: #ffc107;
|
||||
--bs-green: #198754;
|
||||
--bs-teal: #20c997;
|
||||
--bs-cyan: #0dcaf0;
|
||||
--bs-black: #000;
|
||||
--bs-white: #fff;
|
||||
--bs-gray: #6c757d;
|
||||
--bs-gray-dark: #343a40;
|
||||
--bs-gray-100: #f8f9fa;
|
||||
--bs-gray-200: #e9ecef;
|
||||
--bs-gray-300: #dee2e6;
|
||||
--bs-gray-400: #ced4da;
|
||||
--bs-gray-500: #adb5bd;
|
||||
--bs-gray-600: #6c757d;
|
||||
--bs-gray-700: #495057;
|
||||
--bs-gray-800: #343a40;
|
||||
--bs-gray-900: #212529;
|
||||
--bs-primary: #0d6efd;
|
||||
--bs-secondary: #6c757d;
|
||||
--bs-success: #198754;
|
||||
--bs-info: #0dcaf0;
|
||||
--bs-warning: #ffc107;
|
||||
--bs-danger: #dc3545;
|
||||
--bs-light: #f8f9fa;
|
||||
--bs-dark: #212529;
|
||||
--bs-primary-rgb: 13, 110, 253;
|
||||
--bs-secondary-rgb: 108, 117, 125;
|
||||
--bs-success-rgb: 25, 135, 84;
|
||||
--bs-info-rgb: 13, 202, 240;
|
||||
--bs-warning-rgb: 255, 193, 7;
|
||||
--bs-danger-rgb: 220, 53, 69;
|
||||
--bs-light-rgb: 248, 249, 250;
|
||||
--bs-dark-rgb: 33, 37, 41;
|
||||
--bs-primary-text-emphasis: #052c65;
|
||||
--bs-secondary-text-emphasis: #2b2f32;
|
||||
--bs-success-text-emphasis: #0a3622;
|
||||
--bs-info-text-emphasis: #055160;
|
||||
--bs-warning-text-emphasis: #664d03;
|
||||
--bs-danger-text-emphasis: #58151c;
|
||||
--bs-light-text-emphasis: #495057;
|
||||
--bs-dark-text-emphasis: #495057;
|
||||
--bs-primary-bg-subtle: #cfe2ff;
|
||||
--bs-secondary-bg-subtle: #e2e3e5;
|
||||
--bs-success-bg-subtle: #d1e7dd;
|
||||
--bs-info-bg-subtle: #cff4fc;
|
||||
--bs-warning-bg-subtle: #fff3cd;
|
||||
--bs-danger-bg-subtle: #f8d7da;
|
||||
--bs-light-bg-subtle: #fcfcfd;
|
||||
--bs-dark-bg-subtle: #ced4da;
|
||||
--bs-primary-border-subtle: #9ec5fe;
|
||||
--bs-secondary-border-subtle: #c4c8cb;
|
||||
--bs-success-border-subtle: #a3cfbb;
|
||||
--bs-info-border-subtle: #9eeaf9;
|
||||
--bs-warning-border-subtle: #ffe69c;
|
||||
--bs-danger-border-subtle: #f1aeb5;
|
||||
--bs-light-border-subtle: #e9ecef;
|
||||
--bs-dark-border-subtle: #adb5bd;
|
||||
--bs-white-rgb: 255, 255, 255;
|
||||
--bs-black-rgb: 0, 0, 0;
|
||||
--bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||
--bs-font-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
--bs-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
|
||||
--bs-body-font-family: var(--bs-font-sans-serif);
|
||||
--bs-body-font-size: 1rem;
|
||||
--bs-body-font-weight: 400;
|
||||
--bs-body-line-height: 1.5;
|
||||
--bs-body-color: #212529;
|
||||
--bs-body-color-rgb: 33, 37, 41;
|
||||
--bs-body-bg: #fff;
|
||||
--bs-body-bg-rgb: 255, 255, 255;
|
||||
--bs-emphasis-color: #000;
|
||||
--bs-emphasis-color-rgb: 0, 0, 0;
|
||||
--bs-secondary-color: rgba(33, 37, 41, 0.75);
|
||||
--bs-secondary-color-rgb: 33, 37, 41;
|
||||
--bs-secondary-bg: #e9ecef;
|
||||
--bs-secondary-bg-rgb: 233, 236, 239;
|
||||
--bs-tertiary-color: rgba(33, 37, 41, 0.5);
|
||||
--bs-tertiary-color-rgb: 33, 37, 41;
|
||||
--bs-tertiary-bg: #f8f9fa;
|
||||
--bs-tertiary-bg-rgb: 248, 249, 250;
|
||||
--bs-heading-color: inherit;
|
||||
--bs-link-color: #0d6efd;
|
||||
--bs-link-color-rgb: 13, 110, 253;
|
||||
--bs-link-decoration: underline;
|
||||
--bs-link-hover-color: #0a58ca;
|
||||
--bs-link-hover-color-rgb: 10, 88, 202;
|
||||
--bs-code-color: #d63384;
|
||||
--bs-highlight-color: #212529;
|
||||
--bs-highlight-bg: #fff3cd;
|
||||
--bs-border-width: 1px;
|
||||
--bs-border-style: solid;
|
||||
--bs-border-color: #dee2e6;
|
||||
--bs-border-color-translucent: rgba(0, 0, 0, 0.175);
|
||||
--bs-border-radius: 0.375rem;
|
||||
--bs-border-radius-sm: 0.25rem;
|
||||
--bs-border-radius-lg: 0.5rem;
|
||||
--bs-border-radius-xl: 1rem;
|
||||
--bs-border-radius-xxl: 2rem;
|
||||
--bs-border-radius-2xl: var(--bs-border-radius-xxl);
|
||||
--bs-border-radius-pill: 50rem;
|
||||
--bs-box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
|
||||
--bs-box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
|
||||
--bs-box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
|
||||
--bs-box-shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.075);
|
||||
--bs-focus-ring-width: 0.25rem;
|
||||
--bs-focus-ring-opacity: 0.25;
|
||||
--bs-focus-ring-color: rgba(13, 110, 253, 0.25);
|
||||
--bs-form-valid-color: #198754;
|
||||
--bs-form-valid-border-color: #198754;
|
||||
--bs-form-invalid-color: #dc3545;
|
||||
--bs-form-invalid-border-color: #dc3545;
|
||||
}
|
||||
|
||||
[data-bs-theme=dark] {
|
||||
color-scheme: dark;
|
||||
--bs-body-color: #dee2e6;
|
||||
--bs-body-color-rgb: 222, 226, 230;
|
||||
--bs-body-bg: #212529;
|
||||
--bs-body-bg-rgb: 33, 37, 41;
|
||||
--bs-emphasis-color: #fff;
|
||||
--bs-emphasis-color-rgb: 255, 255, 255;
|
||||
--bs-secondary-color: rgba(222, 226, 230, 0.75);
|
||||
--bs-secondary-color-rgb: 222, 226, 230;
|
||||
--bs-secondary-bg: #343a40;
|
||||
--bs-secondary-bg-rgb: 52, 58, 64;
|
||||
--bs-tertiary-color: rgba(222, 226, 230, 0.5);
|
||||
--bs-tertiary-color-rgb: 222, 226, 230;
|
||||
--bs-tertiary-bg: #2b3035;
|
||||
--bs-tertiary-bg-rgb: 43, 48, 53;
|
||||
--bs-primary-text-emphasis: #6ea8fe;
|
||||
--bs-secondary-text-emphasis: #a7acb1;
|
||||
--bs-success-text-emphasis: #75b798;
|
||||
--bs-info-text-emphasis: #6edff6;
|
||||
--bs-warning-text-emphasis: #ffda6a;
|
||||
--bs-danger-text-emphasis: #ea868f;
|
||||
--bs-light-text-emphasis: #f8f9fa;
|
||||
--bs-dark-text-emphasis: #dee2e6;
|
||||
--bs-primary-bg-subtle: #031633;
|
||||
--bs-secondary-bg-subtle: #161719;
|
||||
--bs-success-bg-subtle: #051b11;
|
||||
--bs-info-bg-subtle: #032830;
|
||||
--bs-warning-bg-subtle: #332701;
|
||||
--bs-danger-bg-subtle: #2c0b0e;
|
||||
--bs-light-bg-subtle: #343a40;
|
||||
--bs-dark-bg-subtle: #1a1d20;
|
||||
--bs-primary-border-subtle: #084298;
|
||||
--bs-secondary-border-subtle: #41464b;
|
||||
--bs-success-border-subtle: #0f5132;
|
||||
--bs-info-border-subtle: #087990;
|
||||
--bs-warning-border-subtle: #997404;
|
||||
--bs-danger-border-subtle: #842029;
|
||||
--bs-light-border-subtle: #495057;
|
||||
--bs-dark-border-subtle: #343a40;
|
||||
--bs-heading-color: inherit;
|
||||
--bs-link-color: #6ea8fe;
|
||||
--bs-link-hover-color: #8bb9fe;
|
||||
--bs-link-color-rgb: 110, 168, 254;
|
||||
--bs-link-hover-color-rgb: 139, 185, 254;
|
||||
--bs-code-color: #e685b5;
|
||||
--bs-highlight-color: #dee2e6;
|
||||
--bs-highlight-bg: #664d03;
|
||||
--bs-border-color: #495057;
|
||||
--bs-border-color-translucent: rgba(255, 255, 255, 0.15);
|
||||
--bs-form-valid-color: #75b798;
|
||||
--bs-form-valid-border-color: #75b798;
|
||||
--bs-form-invalid-color: #ea868f;
|
||||
--bs-form-invalid-border-color: #ea868f;
|
||||
}
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
:root {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: var(--bs-body-font-family);
|
||||
font-size: var(--bs-body-font-size);
|
||||
font-weight: var(--bs-body-font-weight);
|
||||
line-height: var(--bs-body-line-height);
|
||||
color: var(--bs-body-color);
|
||||
text-align: var(--bs-body-text-align);
|
||||
background-color: var(--bs-body-bg);
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
hr {
|
||||
margin: 1rem 0;
|
||||
color: inherit;
|
||||
border: 0;
|
||||
border-top: var(--bs-border-width) solid;
|
||||
opacity: 0.25;
|
||||
}
|
||||
|
||||
h6, h5, h4, h3, h2, h1 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0.5rem;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
color: var(--bs-heading-color);
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: calc(1.375rem + 1.5vw);
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h1 {
|
||||
font-size: 2.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: calc(1.325rem + 0.9vw);
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h2 {
|
||||
font-size: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: calc(1.3rem + 0.6vw);
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h3 {
|
||||
font-size: 1.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: calc(1.275rem + 0.3vw);
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h4 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
h5 {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
h6 {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
abbr[title] {
|
||||
-webkit-text-decoration: underline dotted;
|
||||
text-decoration: underline dotted;
|
||||
cursor: help;
|
||||
-webkit-text-decoration-skip-ink: none;
|
||||
text-decoration-skip-ink: none;
|
||||
}
|
||||
|
||||
address {
|
||||
margin-bottom: 1rem;
|
||||
font-style: normal;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul {
|
||||
padding-left: 2rem;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul,
|
||||
dl {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
ol ol,
|
||||
ul ul,
|
||||
ol ul,
|
||||
ul ol {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
dt {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin-bottom: 0.5rem;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
small {
|
||||
font-size: 0.875em;
|
||||
}
|
||||
|
||||
mark {
|
||||
padding: 0.1875em;
|
||||
color: var(--bs-highlight-color);
|
||||
background-color: var(--bs-highlight-bg);
|
||||
}
|
||||
|
||||
sub,
|
||||
sup {
|
||||
position: relative;
|
||||
font-size: 0.75em;
|
||||
line-height: 0;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
a {
|
||||
color: rgba(var(--bs-link-color-rgb), var(--bs-link-opacity, 1));
|
||||
text-decoration: underline;
|
||||
}
|
||||
a:hover {
|
||||
--bs-link-color-rgb: var(--bs-link-hover-color-rgb);
|
||||
}
|
||||
|
||||
a:not([href]):not([class]), a:not([href]):not([class]):hover {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
pre,
|
||||
code,
|
||||
kbd,
|
||||
samp {
|
||||
font-family: var(--bs-font-monospace);
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
pre {
|
||||
display: block;
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
overflow: auto;
|
||||
font-size: 0.875em;
|
||||
}
|
||||
pre code {
|
||||
font-size: inherit;
|
||||
color: inherit;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
code {
|
||||
font-size: 0.875em;
|
||||
color: var(--bs-code-color);
|
||||
word-wrap: break-word;
|
||||
}
|
||||
a > code {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
kbd {
|
||||
padding: 0.1875rem 0.375rem;
|
||||
font-size: 0.875em;
|
||||
color: var(--bs-body-bg);
|
||||
background-color: var(--bs-body-color);
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
kbd kbd {
|
||||
padding: 0;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
figure {
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
|
||||
img,
|
||||
svg {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
table {
|
||||
caption-side: bottom;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
caption {
|
||||
padding-top: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
color: var(--bs-secondary-color);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
th {
|
||||
text-align: inherit;
|
||||
text-align: -webkit-match-parent;
|
||||
}
|
||||
|
||||
thead,
|
||||
tbody,
|
||||
tfoot,
|
||||
tr,
|
||||
td,
|
||||
th {
|
||||
border-color: inherit;
|
||||
border-style: solid;
|
||||
border-width: 0;
|
||||
}
|
||||
|
||||
label {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
button {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
button:focus:not(:focus-visible) {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
input,
|
||||
button,
|
||||
select,
|
||||
optgroup,
|
||||
textarea {
|
||||
margin: 0;
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
button,
|
||||
select {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
[role=button] {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
select {
|
||||
word-wrap: normal;
|
||||
}
|
||||
select:disabled {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
[list]:not([type=date]):not([type=datetime-local]):not([type=month]):not([type=week]):not([type=time])::-webkit-calendar-picker-indicator {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
button,
|
||||
[type=button],
|
||||
[type=reset],
|
||||
[type=submit] {
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
button:not(:disabled),
|
||||
[type=button]:not(:disabled),
|
||||
[type=reset]:not(:disabled),
|
||||
[type=submit]:not(:disabled) {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
::-moz-focus-inner {
|
||||
padding: 0;
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
textarea {
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
min-width: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
legend {
|
||||
float: left;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin-bottom: 0.5rem;
|
||||
font-size: calc(1.275rem + 0.3vw);
|
||||
line-height: inherit;
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
legend {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
legend + * {
|
||||
clear: left;
|
||||
}
|
||||
|
||||
::-webkit-datetime-edit-fields-wrapper,
|
||||
::-webkit-datetime-edit-text,
|
||||
::-webkit-datetime-edit-minute,
|
||||
::-webkit-datetime-edit-hour-field,
|
||||
::-webkit-datetime-edit-day-field,
|
||||
::-webkit-datetime-edit-month-field,
|
||||
::-webkit-datetime-edit-year-field {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
::-webkit-inner-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
[type=search] {
|
||||
-webkit-appearance: textfield;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
/* rtl:raw:
|
||||
[type="tel"],
|
||||
[type="url"],
|
||||
[type="email"],
|
||||
[type="number"] {
|
||||
direction: ltr;
|
||||
}
|
||||
*/
|
||||
::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
::-webkit-color-swatch-wrapper {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
font: inherit;
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
::file-selector-button {
|
||||
font: inherit;
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
output {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
iframe {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
summary {
|
||||
display: list-item;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
[hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=bootstrap-reboot.css.map */
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
594
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.rtl.css
vendored
Normal file
594
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.rtl.css
vendored
Normal file
@@ -0,0 +1,594 @@
|
||||
/*!
|
||||
* Bootstrap Reboot v5.3.3 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2024 The Bootstrap Authors
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
:root,
|
||||
[data-bs-theme=light] {
|
||||
--bs-blue: #0d6efd;
|
||||
--bs-indigo: #6610f2;
|
||||
--bs-purple: #6f42c1;
|
||||
--bs-pink: #d63384;
|
||||
--bs-red: #dc3545;
|
||||
--bs-orange: #fd7e14;
|
||||
--bs-yellow: #ffc107;
|
||||
--bs-green: #198754;
|
||||
--bs-teal: #20c997;
|
||||
--bs-cyan: #0dcaf0;
|
||||
--bs-black: #000;
|
||||
--bs-white: #fff;
|
||||
--bs-gray: #6c757d;
|
||||
--bs-gray-dark: #343a40;
|
||||
--bs-gray-100: #f8f9fa;
|
||||
--bs-gray-200: #e9ecef;
|
||||
--bs-gray-300: #dee2e6;
|
||||
--bs-gray-400: #ced4da;
|
||||
--bs-gray-500: #adb5bd;
|
||||
--bs-gray-600: #6c757d;
|
||||
--bs-gray-700: #495057;
|
||||
--bs-gray-800: #343a40;
|
||||
--bs-gray-900: #212529;
|
||||
--bs-primary: #0d6efd;
|
||||
--bs-secondary: #6c757d;
|
||||
--bs-success: #198754;
|
||||
--bs-info: #0dcaf0;
|
||||
--bs-warning: #ffc107;
|
||||
--bs-danger: #dc3545;
|
||||
--bs-light: #f8f9fa;
|
||||
--bs-dark: #212529;
|
||||
--bs-primary-rgb: 13, 110, 253;
|
||||
--bs-secondary-rgb: 108, 117, 125;
|
||||
--bs-success-rgb: 25, 135, 84;
|
||||
--bs-info-rgb: 13, 202, 240;
|
||||
--bs-warning-rgb: 255, 193, 7;
|
||||
--bs-danger-rgb: 220, 53, 69;
|
||||
--bs-light-rgb: 248, 249, 250;
|
||||
--bs-dark-rgb: 33, 37, 41;
|
||||
--bs-primary-text-emphasis: #052c65;
|
||||
--bs-secondary-text-emphasis: #2b2f32;
|
||||
--bs-success-text-emphasis: #0a3622;
|
||||
--bs-info-text-emphasis: #055160;
|
||||
--bs-warning-text-emphasis: #664d03;
|
||||
--bs-danger-text-emphasis: #58151c;
|
||||
--bs-light-text-emphasis: #495057;
|
||||
--bs-dark-text-emphasis: #495057;
|
||||
--bs-primary-bg-subtle: #cfe2ff;
|
||||
--bs-secondary-bg-subtle: #e2e3e5;
|
||||
--bs-success-bg-subtle: #d1e7dd;
|
||||
--bs-info-bg-subtle: #cff4fc;
|
||||
--bs-warning-bg-subtle: #fff3cd;
|
||||
--bs-danger-bg-subtle: #f8d7da;
|
||||
--bs-light-bg-subtle: #fcfcfd;
|
||||
--bs-dark-bg-subtle: #ced4da;
|
||||
--bs-primary-border-subtle: #9ec5fe;
|
||||
--bs-secondary-border-subtle: #c4c8cb;
|
||||
--bs-success-border-subtle: #a3cfbb;
|
||||
--bs-info-border-subtle: #9eeaf9;
|
||||
--bs-warning-border-subtle: #ffe69c;
|
||||
--bs-danger-border-subtle: #f1aeb5;
|
||||
--bs-light-border-subtle: #e9ecef;
|
||||
--bs-dark-border-subtle: #adb5bd;
|
||||
--bs-white-rgb: 255, 255, 255;
|
||||
--bs-black-rgb: 0, 0, 0;
|
||||
--bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||
--bs-font-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
--bs-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
|
||||
--bs-body-font-family: var(--bs-font-sans-serif);
|
||||
--bs-body-font-size: 1rem;
|
||||
--bs-body-font-weight: 400;
|
||||
--bs-body-line-height: 1.5;
|
||||
--bs-body-color: #212529;
|
||||
--bs-body-color-rgb: 33, 37, 41;
|
||||
--bs-body-bg: #fff;
|
||||
--bs-body-bg-rgb: 255, 255, 255;
|
||||
--bs-emphasis-color: #000;
|
||||
--bs-emphasis-color-rgb: 0, 0, 0;
|
||||
--bs-secondary-color: rgba(33, 37, 41, 0.75);
|
||||
--bs-secondary-color-rgb: 33, 37, 41;
|
||||
--bs-secondary-bg: #e9ecef;
|
||||
--bs-secondary-bg-rgb: 233, 236, 239;
|
||||
--bs-tertiary-color: rgba(33, 37, 41, 0.5);
|
||||
--bs-tertiary-color-rgb: 33, 37, 41;
|
||||
--bs-tertiary-bg: #f8f9fa;
|
||||
--bs-tertiary-bg-rgb: 248, 249, 250;
|
||||
--bs-heading-color: inherit;
|
||||
--bs-link-color: #0d6efd;
|
||||
--bs-link-color-rgb: 13, 110, 253;
|
||||
--bs-link-decoration: underline;
|
||||
--bs-link-hover-color: #0a58ca;
|
||||
--bs-link-hover-color-rgb: 10, 88, 202;
|
||||
--bs-code-color: #d63384;
|
||||
--bs-highlight-color: #212529;
|
||||
--bs-highlight-bg: #fff3cd;
|
||||
--bs-border-width: 1px;
|
||||
--bs-border-style: solid;
|
||||
--bs-border-color: #dee2e6;
|
||||
--bs-border-color-translucent: rgba(0, 0, 0, 0.175);
|
||||
--bs-border-radius: 0.375rem;
|
||||
--bs-border-radius-sm: 0.25rem;
|
||||
--bs-border-radius-lg: 0.5rem;
|
||||
--bs-border-radius-xl: 1rem;
|
||||
--bs-border-radius-xxl: 2rem;
|
||||
--bs-border-radius-2xl: var(--bs-border-radius-xxl);
|
||||
--bs-border-radius-pill: 50rem;
|
||||
--bs-box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
|
||||
--bs-box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
|
||||
--bs-box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
|
||||
--bs-box-shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.075);
|
||||
--bs-focus-ring-width: 0.25rem;
|
||||
--bs-focus-ring-opacity: 0.25;
|
||||
--bs-focus-ring-color: rgba(13, 110, 253, 0.25);
|
||||
--bs-form-valid-color: #198754;
|
||||
--bs-form-valid-border-color: #198754;
|
||||
--bs-form-invalid-color: #dc3545;
|
||||
--bs-form-invalid-border-color: #dc3545;
|
||||
}
|
||||
|
||||
[data-bs-theme=dark] {
|
||||
color-scheme: dark;
|
||||
--bs-body-color: #dee2e6;
|
||||
--bs-body-color-rgb: 222, 226, 230;
|
||||
--bs-body-bg: #212529;
|
||||
--bs-body-bg-rgb: 33, 37, 41;
|
||||
--bs-emphasis-color: #fff;
|
||||
--bs-emphasis-color-rgb: 255, 255, 255;
|
||||
--bs-secondary-color: rgba(222, 226, 230, 0.75);
|
||||
--bs-secondary-color-rgb: 222, 226, 230;
|
||||
--bs-secondary-bg: #343a40;
|
||||
--bs-secondary-bg-rgb: 52, 58, 64;
|
||||
--bs-tertiary-color: rgba(222, 226, 230, 0.5);
|
||||
--bs-tertiary-color-rgb: 222, 226, 230;
|
||||
--bs-tertiary-bg: #2b3035;
|
||||
--bs-tertiary-bg-rgb: 43, 48, 53;
|
||||
--bs-primary-text-emphasis: #6ea8fe;
|
||||
--bs-secondary-text-emphasis: #a7acb1;
|
||||
--bs-success-text-emphasis: #75b798;
|
||||
--bs-info-text-emphasis: #6edff6;
|
||||
--bs-warning-text-emphasis: #ffda6a;
|
||||
--bs-danger-text-emphasis: #ea868f;
|
||||
--bs-light-text-emphasis: #f8f9fa;
|
||||
--bs-dark-text-emphasis: #dee2e6;
|
||||
--bs-primary-bg-subtle: #031633;
|
||||
--bs-secondary-bg-subtle: #161719;
|
||||
--bs-success-bg-subtle: #051b11;
|
||||
--bs-info-bg-subtle: #032830;
|
||||
--bs-warning-bg-subtle: #332701;
|
||||
--bs-danger-bg-subtle: #2c0b0e;
|
||||
--bs-light-bg-subtle: #343a40;
|
||||
--bs-dark-bg-subtle: #1a1d20;
|
||||
--bs-primary-border-subtle: #084298;
|
||||
--bs-secondary-border-subtle: #41464b;
|
||||
--bs-success-border-subtle: #0f5132;
|
||||
--bs-info-border-subtle: #087990;
|
||||
--bs-warning-border-subtle: #997404;
|
||||
--bs-danger-border-subtle: #842029;
|
||||
--bs-light-border-subtle: #495057;
|
||||
--bs-dark-border-subtle: #343a40;
|
||||
--bs-heading-color: inherit;
|
||||
--bs-link-color: #6ea8fe;
|
||||
--bs-link-hover-color: #8bb9fe;
|
||||
--bs-link-color-rgb: 110, 168, 254;
|
||||
--bs-link-hover-color-rgb: 139, 185, 254;
|
||||
--bs-code-color: #e685b5;
|
||||
--bs-highlight-color: #dee2e6;
|
||||
--bs-highlight-bg: #664d03;
|
||||
--bs-border-color: #495057;
|
||||
--bs-border-color-translucent: rgba(255, 255, 255, 0.15);
|
||||
--bs-form-valid-color: #75b798;
|
||||
--bs-form-valid-border-color: #75b798;
|
||||
--bs-form-invalid-color: #ea868f;
|
||||
--bs-form-invalid-border-color: #ea868f;
|
||||
}
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
:root {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: var(--bs-body-font-family);
|
||||
font-size: var(--bs-body-font-size);
|
||||
font-weight: var(--bs-body-font-weight);
|
||||
line-height: var(--bs-body-line-height);
|
||||
color: var(--bs-body-color);
|
||||
text-align: var(--bs-body-text-align);
|
||||
background-color: var(--bs-body-bg);
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
hr {
|
||||
margin: 1rem 0;
|
||||
color: inherit;
|
||||
border: 0;
|
||||
border-top: var(--bs-border-width) solid;
|
||||
opacity: 0.25;
|
||||
}
|
||||
|
||||
h6, h5, h4, h3, h2, h1 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0.5rem;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
color: var(--bs-heading-color);
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: calc(1.375rem + 1.5vw);
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h1 {
|
||||
font-size: 2.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: calc(1.325rem + 0.9vw);
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h2 {
|
||||
font-size: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: calc(1.3rem + 0.6vw);
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h3 {
|
||||
font-size: 1.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: calc(1.275rem + 0.3vw);
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h4 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
h5 {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
h6 {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
abbr[title] {
|
||||
-webkit-text-decoration: underline dotted;
|
||||
text-decoration: underline dotted;
|
||||
cursor: help;
|
||||
-webkit-text-decoration-skip-ink: none;
|
||||
text-decoration-skip-ink: none;
|
||||
}
|
||||
|
||||
address {
|
||||
margin-bottom: 1rem;
|
||||
font-style: normal;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul {
|
||||
padding-right: 2rem;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul,
|
||||
dl {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
ol ol,
|
||||
ul ul,
|
||||
ol ul,
|
||||
ul ol {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
dt {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin-bottom: 0.5rem;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
small {
|
||||
font-size: 0.875em;
|
||||
}
|
||||
|
||||
mark {
|
||||
padding: 0.1875em;
|
||||
color: var(--bs-highlight-color);
|
||||
background-color: var(--bs-highlight-bg);
|
||||
}
|
||||
|
||||
sub,
|
||||
sup {
|
||||
position: relative;
|
||||
font-size: 0.75em;
|
||||
line-height: 0;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
a {
|
||||
color: rgba(var(--bs-link-color-rgb), var(--bs-link-opacity, 1));
|
||||
text-decoration: underline;
|
||||
}
|
||||
a:hover {
|
||||
--bs-link-color-rgb: var(--bs-link-hover-color-rgb);
|
||||
}
|
||||
|
||||
a:not([href]):not([class]), a:not([href]):not([class]):hover {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
pre,
|
||||
code,
|
||||
kbd,
|
||||
samp {
|
||||
font-family: var(--bs-font-monospace);
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
pre {
|
||||
display: block;
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
overflow: auto;
|
||||
font-size: 0.875em;
|
||||
}
|
||||
pre code {
|
||||
font-size: inherit;
|
||||
color: inherit;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
code {
|
||||
font-size: 0.875em;
|
||||
color: var(--bs-code-color);
|
||||
word-wrap: break-word;
|
||||
}
|
||||
a > code {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
kbd {
|
||||
padding: 0.1875rem 0.375rem;
|
||||
font-size: 0.875em;
|
||||
color: var(--bs-body-bg);
|
||||
background-color: var(--bs-body-color);
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
kbd kbd {
|
||||
padding: 0;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
figure {
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
|
||||
img,
|
||||
svg {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
table {
|
||||
caption-side: bottom;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
caption {
|
||||
padding-top: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
color: var(--bs-secondary-color);
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
th {
|
||||
text-align: inherit;
|
||||
text-align: -webkit-match-parent;
|
||||
}
|
||||
|
||||
thead,
|
||||
tbody,
|
||||
tfoot,
|
||||
tr,
|
||||
td,
|
||||
th {
|
||||
border-color: inherit;
|
||||
border-style: solid;
|
||||
border-width: 0;
|
||||
}
|
||||
|
||||
label {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
button {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
button:focus:not(:focus-visible) {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
input,
|
||||
button,
|
||||
select,
|
||||
optgroup,
|
||||
textarea {
|
||||
margin: 0;
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
button,
|
||||
select {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
[role=button] {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
select {
|
||||
word-wrap: normal;
|
||||
}
|
||||
select:disabled {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
[list]:not([type=date]):not([type=datetime-local]):not([type=month]):not([type=week]):not([type=time])::-webkit-calendar-picker-indicator {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
button,
|
||||
[type=button],
|
||||
[type=reset],
|
||||
[type=submit] {
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
button:not(:disabled),
|
||||
[type=button]:not(:disabled),
|
||||
[type=reset]:not(:disabled),
|
||||
[type=submit]:not(:disabled) {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
::-moz-focus-inner {
|
||||
padding: 0;
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
textarea {
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
min-width: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
legend {
|
||||
float: right;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin-bottom: 0.5rem;
|
||||
font-size: calc(1.275rem + 0.3vw);
|
||||
line-height: inherit;
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
legend {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
legend + * {
|
||||
clear: right;
|
||||
}
|
||||
|
||||
::-webkit-datetime-edit-fields-wrapper,
|
||||
::-webkit-datetime-edit-text,
|
||||
::-webkit-datetime-edit-minute,
|
||||
::-webkit-datetime-edit-hour-field,
|
||||
::-webkit-datetime-edit-day-field,
|
||||
::-webkit-datetime-edit-month-field,
|
||||
::-webkit-datetime-edit-year-field {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
::-webkit-inner-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
[type=search] {
|
||||
-webkit-appearance: textfield;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
[type="tel"],
|
||||
[type="url"],
|
||||
[type="email"],
|
||||
[type="number"] {
|
||||
direction: ltr;
|
||||
}
|
||||
::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
::-webkit-color-swatch-wrapper {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
font: inherit;
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
::file-selector-button {
|
||||
font: inherit;
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
output {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
iframe {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
summary {
|
||||
display: list-item;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
[hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
/*# sourceMappingURL=bootstrap-reboot.rtl.css.map */
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
5402
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap-utilities.css
vendored
Normal file
5402
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap-utilities.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
5393
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap-utilities.rtl.css
vendored
Normal file
5393
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap-utilities.rtl.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
12057
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap.css
vendored
Normal file
12057
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap.css.map
vendored
Normal file
1
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap.css.map
vendored
Normal file
File diff suppressed because one or more lines are too long
6
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css
vendored
Normal file
6
YouAreProgrammerShop/YAPWebApplication/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user