настраиваю веб
This commit is contained in:
@@ -76,7 +76,7 @@ namespace ComputerHardwareStoreBusinessLogic.BusinessLogic
|
|||||||
throw new ArgumentNullException(nameof(element));
|
throw new ArgumentNullException(nameof(element));
|
||||||
}
|
}
|
||||||
|
|
||||||
model.OrderProduct = element.OrderProduct;
|
model.OrderProducts = element.OrderProducts;
|
||||||
model.DateCreate = element.DateCreate;
|
model.DateCreate = element.DateCreate;
|
||||||
model.Status = element.Status;
|
model.Status = element.Status;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace ComputerHardwareStoreContracts.ViewModels.HelperModels
|
||||||
|
{
|
||||||
|
public class ComponentSelectionViewModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public bool IsSelected { get; set; }
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,11 +15,13 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.OpenApi" Version="1.6.14" />
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.2" />
|
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.2" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\ComputerHardwareStoreBusinessLogic\ComputerHardwareStoreBusinessLogic.csproj" />
|
||||||
<ProjectReference Include="..\ComputerHardwareStoreDatabaseImplement\ComputerHardwareStoreDatabaseImplement.csproj" />
|
<ProjectReference Include="..\ComputerHardwareStoreDatabaseImplement\ComputerHardwareStoreDatabaseImplement.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,30 +1,40 @@
|
|||||||
using ComputerHardwareStoreContracts.StorageContracts;
|
using ComputerHardwareStoreBusinessLogic.BusinessLogic;
|
||||||
|
using ComputerHardwareStoreContracts.BusinessLogicsContracts;
|
||||||
|
using ComputerHardwareStoreContracts.StorageContracts;
|
||||||
using ComputerHardwareStoreDatabaseImplement;
|
using ComputerHardwareStoreDatabaseImplement;
|
||||||
using ComputerHardwareStoreDatabaseImplement.Implements;
|
using ComputerHardwareStoreDatabaseImplement.Implements;
|
||||||
using ComputerHardwareStoreREST;
|
using ComputerHardwareStoreREST;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.OpenApi.Models;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
|
|
||||||
|
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
|
||||||
builder.Services.AddSwaggerGen();
|
|
||||||
|
|
||||||
// получаем строку подключения из файла конфигурации
|
// получаем строку подключения из файла конфигурации
|
||||||
//DBSetting.ConectionString = builder.Configuration.GetConnectionString("DefaultConnection");
|
//DBSetting.ConectionString = builder.Configuration.GetConnectionString("DefaultConnection");
|
||||||
|
|
||||||
builder.Services.AddSingleton<IComponentStorage, ComponentStorage >();
|
builder.Services.AddTransient<IVendorStorage, VendorStorage>();
|
||||||
builder.Services.AddSingleton<IStoreKeeperStorage, StoreKeeperStorage>();
|
builder.Services.AddTransient<IPurchaseStorage, PurchaseStorage>();
|
||||||
builder.Services.AddSingleton<IProductStorage, ProductStorage>();
|
builder.Services.AddTransient<IBuildStorage, BuildStorage>();
|
||||||
builder.Services.AddSingleton<IOrderStorage, OrderStorage>();
|
builder.Services.AddTransient<ICommentStorage, CommentStorage>();
|
||||||
builder.Services.AddSingleton<IBuildStorage, BuildStorage>();
|
builder.Services.AddTransient<IProductStorage, ProductStorage>();
|
||||||
builder.Services.AddSingleton<ICommentStorage, CommentStorage>();
|
builder.Services.AddTransient<IComponentStorage, ComponentStorage>();
|
||||||
builder.Services.AddSingleton<IPurchaseStorage, PurchaseStorage>();
|
builder.Services.AddTransient<IStoreKeeperStorage, StoreKeeperStorage>();
|
||||||
builder.Services.AddSingleton<IVendorStorage, VendorStorage>();
|
|
||||||
|
|
||||||
|
builder.Services.AddTransient<IVendorLogic, VendorLogic>();
|
||||||
|
builder.Services.AddTransient<IPurchaseLogic, PurchaseLogic>();
|
||||||
|
builder.Services.AddTransient<IBuildLogic, BuildLogic>();
|
||||||
|
builder.Services.AddTransient<ICommentLogic, CommentLogic>();
|
||||||
|
//builder.Services.AddTransient<IProductLogic, ProductLogic>();
|
||||||
|
builder.Services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||||
|
builder.Services.AddTransient<IStoreKeeperLogic, StoreKeeperLogic>();
|
||||||
|
|
||||||
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
|
builder.Services.AddSwaggerGen();
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
@@ -34,6 +44,7 @@ if (app.Environment.IsDevelopment())
|
|||||||
app.UseSwaggerUI();
|
app.UseSwaggerUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.UseHttpsRedirection();
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
|
|||||||
43
ComputerHardwareStore/StoreKeeperClient/APIClient.cs
Normal file
43
ComputerHardwareStore/StoreKeeperClient/APIClient.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
using ComputerHardwareStoreContracts.ViewModels;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace StoreKeeperClient
|
||||||
|
{
|
||||||
|
public static class APIClient
|
||||||
|
{
|
||||||
|
private static readonly HttpClient _client = new();
|
||||||
|
public static StoreKeeperViewModel? Client { get; set; } = null;
|
||||||
|
public static void Connect(IConfiguration configuration)
|
||||||
|
{
|
||||||
|
_client.BaseAddress = new Uri(configuration["IPAddress"]);
|
||||||
|
_client.DefaultRequestHeaders.Accept.Clear();
|
||||||
|
_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||||
|
}
|
||||||
|
public static T? GetRequest<T>(string requestUrl)
|
||||||
|
{
|
||||||
|
var response = _client.GetAsync(requestUrl);
|
||||||
|
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||||
|
if (response.Result.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
return JsonConvert.DeserializeObject<T>(result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void PostRequest<T>(string requestUrl, T model)
|
||||||
|
{
|
||||||
|
var json = JsonConvert.SerializeObject(model);
|
||||||
|
var data = new StringContent(json, Encoding.UTF8, "application/json");
|
||||||
|
var response = _client.PostAsync(requestUrl, data);
|
||||||
|
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||||
|
if (!response.Result.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
throw new Exception(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using StoreKeeperClient.Models;
|
using StoreKeeperClient.Models;
|
||||||
|
using ComputerHardwareStoreContracts.BindingModels;
|
||||||
|
|
||||||
namespace StoreKeeperClient.Controllers
|
namespace StoreKeeperClient.Controllers
|
||||||
{
|
{
|
||||||
@@ -17,16 +18,49 @@ namespace StoreKeeperClient.Controllers
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
return View();
|
if (APIClient.Client == null)
|
||||||
}
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
|
||||||
|
return View(APIClient.GetRequest<List<PurchaseViewModel>>($"api/main/getpurchases?clientId={APIClient.Client.Id}"));
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult Privacy()
|
public IActionResult Privacy()
|
||||||
{
|
{
|
||||||
return View();
|
if (APIClient.Client == null)
|
||||||
}
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
return View(APIClient.Client);
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpPost]
|
||||||
|
public void Privacy(string login, string password, string fio)
|
||||||
|
{
|
||||||
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
|
||||||
|
{
|
||||||
|
throw new Exception("Введите логин, пароль и ФИО");
|
||||||
|
}
|
||||||
|
APIClient.PostRequest("api/client/updatedata", new StoreKeeperBindingModel
|
||||||
|
{
|
||||||
|
Id = APIClient.Client.Id,
|
||||||
|
Name = fio,
|
||||||
|
Login = login,
|
||||||
|
Password = password
|
||||||
|
});
|
||||||
|
APIClient.Client.Name = fio;
|
||||||
|
APIClient.Client.Login = login;
|
||||||
|
APIClient.Client.Password = password;
|
||||||
|
Response.Redirect("Index");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
public IActionResult Enter()
|
public IActionResult Enter()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
@@ -35,103 +69,168 @@ namespace StoreKeeperClient.Controllers
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult Register()
|
public IActionResult Register()
|
||||||
{
|
{
|
||||||
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult AddBuildToPurchase()
|
public IActionResult AddBuildToPurchase()
|
||||||
{
|
{
|
||||||
return View();
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult Builds()
|
public IActionResult Builds()
|
||||||
{
|
{
|
||||||
return View(new List<BuildViewModel>());
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
return View(new List<BuildViewModel>());
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult BuildCreate()
|
public IActionResult BuildCreate()
|
||||||
{
|
{
|
||||||
return View();
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult BuildDelete()
|
public IActionResult BuildDelete()
|
||||||
{
|
{
|
||||||
return View();
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult BuildUpdate()
|
public IActionResult BuildUpdate()
|
||||||
{
|
{
|
||||||
return View();
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult CommentCreate()
|
public IActionResult CommentCreate()
|
||||||
{
|
{
|
||||||
return View();
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult CommentDelete()
|
public IActionResult CommentDelete()
|
||||||
{
|
{
|
||||||
return View();
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult CommentUpdate()
|
public IActionResult CommentUpdate()
|
||||||
{
|
{
|
||||||
return View();
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult Comments()
|
public IActionResult Comments()
|
||||||
{
|
{
|
||||||
return View(new List<CommentViewModel>());
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
return View(new List<CommentViewModel>());
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult ProductsList()
|
public IActionResult ProductsList()
|
||||||
{
|
{
|
||||||
return View(new List<BuildViewModel>());
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
return View(new List<BuildViewModel>());
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult PurchaseCreate()
|
public IActionResult PurchaseCreate()
|
||||||
{
|
{
|
||||||
return View();
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult PurchaseDelete()
|
public IActionResult PurchaseDelete()
|
||||||
{
|
{
|
||||||
return View();
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult Purchases()
|
public IActionResult Purchases()
|
||||||
{
|
{
|
||||||
return View(new List<PurchaseViewModel>());
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
return View(new List<PurchaseViewModel>());
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult PurchaseUpdate()
|
public IActionResult PurchaseUpdate()
|
||||||
{
|
{
|
||||||
return View();
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult Report()
|
public IActionResult Report()
|
||||||
{
|
{
|
||||||
return View(new List<PurchaseViewModel>());
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
return View(new List<PurchaseViewModel>());
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void Report(string password)
|
public void Report(string password)
|
||||||
{
|
{
|
||||||
Response.Redirect("ReportOnly");
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
Response.Redirect("ReportOnly");
|
||||||
}
|
}
|
||||||
|
|
||||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||||
|
|||||||
@@ -0,0 +1,385 @@
|
|||||||
|
using ComputerHardwareStoreContracts.BindingModels;
|
||||||
|
using ComputerHardwareStoreContracts.BusinessLogicsContracts;
|
||||||
|
using ComputerHardwareStoreContracts.SearchModels;
|
||||||
|
using ComputerHardwareStoreContracts.ViewModels;
|
||||||
|
using ComputerHardwareStoreContracts.ViewModels.HelperModels;
|
||||||
|
using ComputerHardwareStoreDataModels.Models;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace StoreKeeperClient.Controllers
|
||||||
|
{
|
||||||
|
public class StoreKeeperController : Controller
|
||||||
|
{
|
||||||
|
private readonly ILogger<HomeController> _logger;
|
||||||
|
private readonly IStoreKeeperLogic _storeKeeperLogic;
|
||||||
|
private readonly IComponentLogic _componentLogic;
|
||||||
|
private readonly IBuildLogic _buildLogic;
|
||||||
|
private readonly IProductLogic _productLogic;
|
||||||
|
|
||||||
|
public StoreKeeperController(ILogger<HomeController> logger, IComponentLogic componentLogic, IBuildLogic buildLogic, IProductLogic productLogic, IStoreKeeperLogic storeKeeperLogic)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_componentLogic = componentLogic;
|
||||||
|
_buildLogic = buildLogic;
|
||||||
|
_productLogic = productLogic;
|
||||||
|
_storeKeeperLogic = storeKeeperLogic;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void CreateComponent(string name, double price)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(name))
|
||||||
|
{
|
||||||
|
throw new Exception("Enter name");
|
||||||
|
}
|
||||||
|
_componentLogic.Create(
|
||||||
|
new ComponentBindingModel
|
||||||
|
{
|
||||||
|
Name = name,
|
||||||
|
Cost = price,
|
||||||
|
StoreKeeper = APIClient.Client!
|
||||||
|
}
|
||||||
|
);
|
||||||
|
Response.Redirect("Components");
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult UpdateComponent()
|
||||||
|
{
|
||||||
|
ViewBag.Components = _componentLogic.ReadList(
|
||||||
|
new ComponentSearchModel
|
||||||
|
{
|
||||||
|
StoreKeeperId = APIClient.Client.Id
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void UpdateComponent(int component, double price, string name)
|
||||||
|
{
|
||||||
|
if (component == 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Chose component");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(name))
|
||||||
|
{
|
||||||
|
throw new Exception("Enter name");
|
||||||
|
}
|
||||||
|
_componentLogic.Update(
|
||||||
|
new ComponentBindingModel
|
||||||
|
{
|
||||||
|
Id = component,
|
||||||
|
Name = name,
|
||||||
|
Cost = price,
|
||||||
|
StoreKeeper = APIClient.Client!
|
||||||
|
}
|
||||||
|
);
|
||||||
|
Response.Redirect("Components");
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult ComponentToBuild()
|
||||||
|
{
|
||||||
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
ViewBag.Assemblies = _buildLogic.ReadList(null);
|
||||||
|
ViewBag.Components = _componentLogic.ReadList(
|
||||||
|
new ComponentSearchModel
|
||||||
|
{
|
||||||
|
StoreKeeperId = APIClient.Client!.Id
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void ComponentToBuild(int buildId, int componentId, int count)
|
||||||
|
{
|
||||||
|
if (buildId == 0)
|
||||||
|
{
|
||||||
|
throw new Exception("chose build");
|
||||||
|
}
|
||||||
|
if (componentId == 0)
|
||||||
|
{
|
||||||
|
throw new Exception("chose component");
|
||||||
|
}
|
||||||
|
if (count <= 0)
|
||||||
|
{
|
||||||
|
throw new Exception("chose count");
|
||||||
|
}
|
||||||
|
BuildViewModel build = _buildLogic.ReadElement(new BuildSearchModel { Id = buildId })!;
|
||||||
|
ComponentViewModel component = _componentLogic.ReadElement(new ComponentSearchModel { Id = componentId })!;
|
||||||
|
if (build.BuildComponents.ContainsKey(componentId))
|
||||||
|
build.BuildComponents[componentId] = (component, build.BuildComponents[componentId].Item2 + count);
|
||||||
|
else
|
||||||
|
build.BuildComponents.Add(componentId, (component, count));
|
||||||
|
build.Price += component.Cost * count;
|
||||||
|
_buildLogic.Update(
|
||||||
|
new BuildBindingModel
|
||||||
|
{
|
||||||
|
Id = buildId,
|
||||||
|
Vendor = build.Vendor,
|
||||||
|
Name = build.Name,
|
||||||
|
Price = build.Price,
|
||||||
|
BuildComponents = build.BuildComponents
|
||||||
|
});
|
||||||
|
Response.Redirect("Components");
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult RemoveComponentFromBuild()
|
||||||
|
{
|
||||||
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
ViewBag.Assemblies = _buildLogic.ReadList(null);
|
||||||
|
ViewBag.Components = _componentLogic.ReadList(
|
||||||
|
new ComponentSearchModel
|
||||||
|
{
|
||||||
|
StoreKeeperId = APIClient.Client!.Id
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void RemoveComponentFromBuild(int buildId, int componentId, int count)
|
||||||
|
{
|
||||||
|
if (buildId == 0)
|
||||||
|
{
|
||||||
|
throw new Exception("chose build");
|
||||||
|
}
|
||||||
|
if (componentId == 0)
|
||||||
|
{
|
||||||
|
throw new Exception("chose component");
|
||||||
|
}
|
||||||
|
if (count <= 0)
|
||||||
|
{
|
||||||
|
throw new Exception("chose count");
|
||||||
|
}
|
||||||
|
BuildViewModel build = _buildLogic.ReadElement(new BuildSearchModel { Id = buildId })!;
|
||||||
|
ComponentViewModel component = _componentLogic.ReadElement(new ComponentSearchModel { Id = componentId })!;
|
||||||
|
if (build.BuildComponents.ContainsKey(componentId))
|
||||||
|
{
|
||||||
|
if (build.BuildComponents[componentId].Item2 < count)
|
||||||
|
throw new Exception("ther is not enough components in build");
|
||||||
|
if (build.BuildComponents[componentId].Item2 == count)
|
||||||
|
build.BuildComponents.Remove(componentId);
|
||||||
|
else
|
||||||
|
build.BuildComponents[componentId] = (component, build.BuildComponents[componentId].Item2 - count);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new Exception("there is no that component in build");
|
||||||
|
build.Price -= component.Cost * count;
|
||||||
|
_buildLogic.Update(
|
||||||
|
new BuildBindingModel
|
||||||
|
{
|
||||||
|
Id = buildId,
|
||||||
|
Vendor = build.Vendor,
|
||||||
|
Name = build.Name,
|
||||||
|
Price = build.Price,
|
||||||
|
BuildComponents = build.BuildComponents
|
||||||
|
});
|
||||||
|
Response.Redirect("Components");
|
||||||
|
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult DeleteComponent()
|
||||||
|
{
|
||||||
|
ViewBag.Components = _componentLogic.ReadList(
|
||||||
|
new ComponentSearchModel
|
||||||
|
{
|
||||||
|
StoreKeeperId = APIClient.Client.Id
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void DeleteComponent(int component)
|
||||||
|
{
|
||||||
|
if (component == 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Chose component");
|
||||||
|
}
|
||||||
|
_componentLogic.Delete(
|
||||||
|
new ComponentBindingModel { Id = component }
|
||||||
|
);
|
||||||
|
Response.Redirect("Components");
|
||||||
|
}
|
||||||
|
|
||||||
|
// товары
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult CreateProduct()
|
||||||
|
{
|
||||||
|
return View(_componentLogic.ReadList(null));
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void CreateProduct(double price, string name, List<ComponentSelectionViewModel> components)
|
||||||
|
{
|
||||||
|
var selectedComponents = components.Where(g => g.IsSelected && g.Quantity > 0).ToList();
|
||||||
|
List<ComponentViewModel> componentsViewModels = _componentLogic.ReadList(null)!;
|
||||||
|
Dictionary<int, (IComponentModel, int)> productComponents = new Dictionary<int, (IComponentModel, int)>();
|
||||||
|
price = 0;
|
||||||
|
foreach (var component in selectedComponents)
|
||||||
|
{
|
||||||
|
productComponents.Add(component.Id, (
|
||||||
|
componentsViewModels.FirstOrDefault(x => x.Id == component.Id)!,
|
||||||
|
component.Quantity
|
||||||
|
));
|
||||||
|
price += component.Quantity * componentsViewModels.FirstOrDefault(x => x.Id == component.Id)!.ComponentPrice;
|
||||||
|
|
||||||
|
}
|
||||||
|
_productLogic.Create(
|
||||||
|
new ProductBindingModel
|
||||||
|
{
|
||||||
|
Name = name,
|
||||||
|
Price = price,
|
||||||
|
StoreKeeper = APIClient.Client!,
|
||||||
|
ProductComponents = productComponents,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
Response.Redirect("Products");
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult UpdateProduct(int productId)
|
||||||
|
{
|
||||||
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
ViewBag.Components = APIClient.GetRequest<List<ComponentViewModel>>($"api/component/getcomponents?clientId={APIClient.Client.Id}");
|
||||||
|
return View(productId);
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void UpdateProduct(double price, string name, List<ComponentSelectionViewModel> components, int product)
|
||||||
|
{
|
||||||
|
if (product == 0)
|
||||||
|
{
|
||||||
|
throw new Exception("chose product");
|
||||||
|
}
|
||||||
|
var selectedComponents = components.Where(g => g.IsSelected && g.Quantity > 0).ToList();
|
||||||
|
List<ComponentViewModel> componentsViewModels = _componentLogic.ReadList(null)!;
|
||||||
|
Dictionary<int, (IComponentModel, int)> productComponents = new Dictionary<int, (IComponentModel, int)>();
|
||||||
|
price = 0;
|
||||||
|
// добавляем в
|
||||||
|
foreach (var component in selectedComponents)
|
||||||
|
{
|
||||||
|
productComponents.Add(component.Id, (
|
||||||
|
componentsViewModels.FirstOrDefault(x => x.Id == component.Id)!,
|
||||||
|
component.Quantity
|
||||||
|
));
|
||||||
|
price += component.Quantity * componentsViewModels.FirstOrDefault(x => x.Id == component.Id)!.Cost;
|
||||||
|
}
|
||||||
|
_productLogic.Update(
|
||||||
|
new ProductBindingModel
|
||||||
|
{
|
||||||
|
Id = product,
|
||||||
|
StoreKeeper = APIClient.Client,
|
||||||
|
Price = price,
|
||||||
|
Name = name,
|
||||||
|
ProductComponents = productComponents
|
||||||
|
});
|
||||||
|
Response.Redirect("Products");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult DeleteProduct()
|
||||||
|
{
|
||||||
|
var products = _productLogic.ReadList(
|
||||||
|
new ProductSearchModel
|
||||||
|
{
|
||||||
|
StoreKeeperId = APIClient.Client!.Id
|
||||||
|
}
|
||||||
|
);
|
||||||
|
ViewBag.Products = products;
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void DeleteProduct(int product)
|
||||||
|
{
|
||||||
|
_productLogic.Delete(
|
||||||
|
new ProductBindingModel { Id = product }
|
||||||
|
);
|
||||||
|
Response.Redirect("Products");
|
||||||
|
}
|
||||||
|
|
||||||
|
// заказы
|
||||||
|
|
||||||
|
//[HttpGet]
|
||||||
|
//public IActionResult CreateOrder()
|
||||||
|
//{
|
||||||
|
// ViewBag.Products = _productLogic.ReadList(
|
||||||
|
// new ProductSearchModel
|
||||||
|
// {
|
||||||
|
// StoreKeeperId = APIClient.Client!.Id
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
// return View();
|
||||||
|
//}
|
||||||
|
//[HttpPost]
|
||||||
|
//public void CreateOrder(DateTime date, string address, int product)
|
||||||
|
//{
|
||||||
|
// _orderForProductsLogic.Create(
|
||||||
|
// new OrderForProductsBindingModel
|
||||||
|
// {
|
||||||
|
// OrderDate = date,
|
||||||
|
// DeliveryAddres = address,
|
||||||
|
// ProductId = product,
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
// Response.Redirect("Orders");
|
||||||
|
//}
|
||||||
|
//[HttpGet]
|
||||||
|
//public IActionResult UpdateOrder()
|
||||||
|
//{
|
||||||
|
// ViewBag.Products = _productLogic.ReadList(
|
||||||
|
// new ProductSearchModel
|
||||||
|
// {
|
||||||
|
// StoreKeeperId = APIClient.Client!.Id
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
// ViewBag.OrdersForProducts = _orderForProductsLogic.ReadList(
|
||||||
|
// new OrderForProductsSearchModel
|
||||||
|
// {
|
||||||
|
// StoreKeeperId = APIClient.Client!.Id
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
// return View();
|
||||||
|
//}
|
||||||
|
//[HttpPost]
|
||||||
|
//public void UpdateOrder(DateTime date, string address, int product, int order)
|
||||||
|
//{
|
||||||
|
// _orderForProductsLogic.Update(
|
||||||
|
// new OrderForProductsBindingModel
|
||||||
|
// {
|
||||||
|
// Id = order,
|
||||||
|
// OrderDate = date,
|
||||||
|
// DeliveryAddres = address,
|
||||||
|
// ProductId = product
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
// Response.Redirect("Orders");
|
||||||
|
//}
|
||||||
|
|
||||||
|
//[HttpGet]
|
||||||
|
//public IActionResult DeleteOrder()
|
||||||
|
//{
|
||||||
|
// ViewBag.OrdersForProducts = _orderForProductsLogic.ReadList(
|
||||||
|
// new OrderForProductsSearchModel
|
||||||
|
// {
|
||||||
|
// StoreKeeperId = APIClient.Client!.Id
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
// return View();
|
||||||
|
//}
|
||||||
|
//[HttpPost]
|
||||||
|
//public void DeleteOrder(int order)
|
||||||
|
//{
|
||||||
|
// _orderForProductsLogic.Delete(
|
||||||
|
// new OrderForProductsBindingModel
|
||||||
|
// {
|
||||||
|
// Id = order,
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
// Response.Redirect("Orders");
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,43 +7,22 @@ var builder = WebApplication.CreateBuilder(args);
|
|||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
|
|
||||||
builder.Services.AddControllersWithViews();
|
builder.Services.AddControllers();
|
||||||
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
|
builder.Services.AddSwaggerGen();
|
||||||
builder.Services.AddTransient<IVendorStorage, VendorStorage>();
|
|
||||||
builder.Services.AddTransient<IPurchaseStorage, PurchaseStorage>();
|
|
||||||
builder.Services.AddTransient<IBuildStorage, BuildStorage>();
|
|
||||||
builder.Services.AddTransient<ICommentStorage, CommentStorage>();
|
|
||||||
builder.Services.AddTransient<IProductStorage, ProductStorage>();
|
|
||||||
builder.Services.AddTransient<IComponentStorage, ComponentStorage>();
|
|
||||||
builder.Services.AddTransient<IStoreKeeperStorage, StoreKeeperStorage>();
|
|
||||||
builder.Services.AddTransient<IVendorLogic, VendorLogic>();
|
|
||||||
builder.Services.AddTransient<IPurchaseLogic, PurchaseLogic>();
|
|
||||||
builder.Services.AddTransient<IBuildLogic, BuildLogic>();
|
|
||||||
builder.Services.AddTransient<ICommentLogic, CommentLogic>();
|
|
||||||
builder.Services.AddTransient<IProductLogic, ProductLogic>();
|
|
||||||
builder.Services.AddTransient<IComponentLogic, ComponentLogic>();
|
|
||||||
builder.Services.AddTransient<IStoreKeeperLogic, StoreKeeperLogic>();
|
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseSwagger();
|
app.UseSwagger();
|
||||||
app.UseSwaggerUI();
|
app.UseSwaggerUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
|
||||||
app.UseStaticFiles();
|
|
||||||
|
|
||||||
app.UseRouting();
|
|
||||||
|
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
|
||||||
app.MapControllerRoute(
|
app.MapControllers();
|
||||||
name: "default",
|
|
||||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -44,10 +44,10 @@
|
|||||||
@Html.DisplayFor(modelItem => component.Id)
|
@Html.DisplayFor(modelItem => component.Id)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => component.ComponentName)
|
@Html.DisplayFor(modelItem => component.Name)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => component.ComponentPrice)
|
@Html.DisplayFor(modelItem => component.Cost)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,68 @@
|
|||||||
@{
|
@using ComputerHardwareStoreContracts.ViewModels
|
||||||
ViewData["Title"] = "Home Page";
|
@model List<OrderViewModel>
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Home Page";
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<img src="./Images/Logo.jpg" alt="logo" />
|
<h1 class="display-4">Заказы</h1>
|
||||||
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
@{
|
||||||
|
if (Model == null)
|
||||||
|
{
|
||||||
|
<h3 class="display-4">Авторизируйтесь</h3>
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
<p>
|
||||||
|
<a asp-action="Create">Создать заказ</a>
|
||||||
|
</p>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Номер
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Изделие
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Дата создания
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Количество
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Сумма
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Статус
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var item in Model)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Id)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
// вообще тут ордер . продуктс
|
||||||
|
@Html.DisplayFor(modelItem => item.Status)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.DateCreate)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Sum)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Status)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
@using ComputerHardwareStoreContracts.ViewModels
|
@using ComputerHardwareStoreContracts.ViewModels
|
||||||
@model List<OrderForProductsViewModel>
|
@model List<OrderViewModel>
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Orders";
|
ViewData["Title"] = "Orders";
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
@Html.DisplayFor(modelItem => order.DateCreate)
|
@Html.DisplayFor(modelItem => order.DateCreate)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => order.DateImplemet)
|
@Html.DisplayFor(modelItem => order.DateImplement)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
@using ComputerHardwareStoreContracts.ViewModels
|
||||||
|
@model List<PurchaseViewModel>
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Purchases";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h1 class="display-4">Покупки товаров и сборок</h1>
|
||||||
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
@{
|
||||||
|
if (Model == null)
|
||||||
|
{
|
||||||
|
<h3 class="display-4">Надо войти!</h3>
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
<p>
|
||||||
|
<a class="text-decoration-none me-3 text-black h5" asp-action="CreatePurchase">Создать покупку</a>
|
||||||
|
<a class="text-decoration-none me-3 text-black h5" asp-action="UpdatePurchase">Изменить покупку</a>
|
||||||
|
<a class="text-decoration-none text-black h5" asp-action="DeletePurchase">Удалить покупку</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<table class="PurchaseTable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Номер
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Дата создания
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Дата выполнения
|
||||||
|
</th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var purchase in Model)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => purchase.Id)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => purchase.DateCreate)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => purchase.DateImplement)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
@model ErrorViewModel
|
||||||
|
@{
|
||||||
|
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 <strong>Development</strong> environment will display more 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>
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>@ViewData["Title"] - ComputerStoreWorkerApp</title>
|
||||||
|
<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="~/ComputerStoreWorkerApp.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-fluid">
|
||||||
|
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">ComputerStoreWorkerApp</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-controller="Home" asp-action="Index">Home</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="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">
|
||||||
|
© 2024 - ComputerStoreWorkerApp - <a asp-area="" asp-controller="Home" asp-action="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://docs.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/jquery.validate.unobtrusive.min.js"></script>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
@using StoreKeeperClient
|
||||||
|
@using StoreKeeperClient.Models
|
||||||
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
@{
|
||||||
|
Layout = "_Layout";
|
||||||
|
}
|
||||||
@@ -5,5 +5,7 @@
|
|||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*",
|
||||||
|
|
||||||
|
"IPAddress": "http://localhost:7291/"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,5 +5,6 @@
|
|||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*",
|
||||||
|
"IPAddress": "http://localhost:7085/"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user