add scope and materials
This commit is contained in:
parent
ba9e854c9e
commit
8caf2860a6
@ -78,6 +78,7 @@ namespace FurnitureAssemblyDatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
using var context = new FurnitureAssemblyDatabase();
|
using var context = new FurnitureAssemblyDatabase();
|
||||||
var material = context.Materials
|
var material = context.Materials
|
||||||
|
.Include(x => x.Scope)
|
||||||
.Include(x => x.User)
|
.Include(x => x.User)
|
||||||
.FirstOrDefault(x => x.Id == model.Id);
|
.FirstOrDefault(x => x.Id == model.Id);
|
||||||
if (material == null)
|
if (material == null)
|
||||||
@ -93,6 +94,7 @@ namespace FurnitureAssemblyDatabaseImplement.Implements
|
|||||||
using var context = new FurnitureAssemblyDatabase();
|
using var context = new FurnitureAssemblyDatabase();
|
||||||
var element = context.Materials
|
var element = context.Materials
|
||||||
.Include(x => x.User)
|
.Include(x => x.User)
|
||||||
|
.Include(x => x.Scope)
|
||||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
if (element != null)
|
if (element != null)
|
||||||
{
|
{
|
||||||
|
@ -58,9 +58,9 @@ namespace FurnitureAssemblyDatabaseImplement.Models
|
|||||||
Name = Name,
|
Name = Name,
|
||||||
Cost = Cost,
|
Cost = Cost,
|
||||||
ScopeId = ScopeId,
|
ScopeId = ScopeId,
|
||||||
ScopeName = Scope.Name,
|
ScopeName = Scope?.Name,
|
||||||
UserId = UserId,
|
UserId = UserId,
|
||||||
UserName = User.Name
|
UserName = User?.Name
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ namespace FurnitureAssemblyRestApi.Controllers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка получения списка мебельных модулей");
|
_logger.LogError(ex, "Ошибка получения списка материалов");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ namespace FurnitureAssemblyRestApi.Controllers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка получения мебельного модуля по id={Id}", Id);
|
_logger.LogError(ex, "Ошибка получения материала по id={Id}", Id);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ namespace FurnitureAssemblyRestApi.Controllers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка создания мебельного модуля");
|
_logger.LogError(ex, "Ошибка создания материала");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ namespace FurnitureAssemblyRestApi.Controllers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка обновления мебельного модуля");
|
_logger.LogError(ex, "Ошибка обновления материала");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ namespace FurnitureAssemblyRestApi.Controllers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка удаления мебельного модуля");
|
_logger.LogError(ex, "Ошибка удаления материала");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ namespace FurnitureAssemblyRestApi.Controllers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка получения списка мебельных модулей");
|
_logger.LogError(ex, "Ошибка получения списка областей");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ namespace FurnitureAssemblyRestApi.Controllers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка получения мебельного модуля по id={Id}", Id);
|
_logger.LogError(ex, "Ошибка получения области по id={Id}", Id);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ namespace FurnitureAssemblyRestApi.Controllers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка создания мебельного модуля");
|
_logger.LogError(ex, "Ошибка создания области");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ namespace FurnitureAssemblyRestApi.Controllers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка обновления мебельного модуля");
|
_logger.LogError(ex, "Ошибка обновления области");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ namespace FurnitureAssemblyRestApi.Controllers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка удаления мебельного модуля");
|
_logger.LogError(ex, "Ошибка удаления области");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ namespace FurnitureAssemblyStoreKeeperClientApp.Controllers
|
|||||||
return View(APIClient.GetRequest<List<RoleViewModel>>($"api/role/getrolelist"));
|
return View(APIClient.GetRequest<List<RoleViewModel>>($"api/role/getrolelist"));
|
||||||
}
|
}
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void Register(string login, string password, string name, int roleId)
|
public void Register(string login, string password, string name, int roleid)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(name))
|
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(name))
|
||||||
{
|
{
|
||||||
@ -91,10 +91,184 @@ namespace FurnitureAssemblyStoreKeeperClientApp.Controllers
|
|||||||
Name = name,
|
Name = name,
|
||||||
Login = login,
|
Login = login,
|
||||||
Password = password,
|
Password = password,
|
||||||
RoleId = roleId
|
RoleId = roleid
|
||||||
});
|
});
|
||||||
Response.Redirect("Enter");
|
Response.Redirect("Enter");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult GetScopeList()
|
||||||
|
{
|
||||||
|
return View(APIClient.GetRequest<List<ScopeViewModel>>($"api/scope/GetScopeList"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult CreateScope()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void CreateScope(string name)
|
||||||
|
{
|
||||||
|
if (APIClient.User == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали?");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(name))
|
||||||
|
{
|
||||||
|
throw new Exception("Название не указано");
|
||||||
|
}
|
||||||
|
|
||||||
|
APIClient.PostRequest("api/scope/addscope", new ScopeBindingModel
|
||||||
|
{
|
||||||
|
Name = name
|
||||||
|
});
|
||||||
|
Response.Redirect("GetScopeList");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult UpdateScope()
|
||||||
|
{
|
||||||
|
if (APIClient.User == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
return View(APIClient.GetRequest<List<ScopeViewModel>>($"api/scope/GetScopeList"));
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void UpdateScope(int scope, string name)
|
||||||
|
{
|
||||||
|
if (APIClient.User == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали?");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(name))
|
||||||
|
{
|
||||||
|
throw new Exception("Название не указано");
|
||||||
|
}
|
||||||
|
|
||||||
|
APIClient.PostRequest("api/scope/updatescope", new ScopeBindingModel
|
||||||
|
{
|
||||||
|
Id = scope,
|
||||||
|
Name = name
|
||||||
|
});
|
||||||
|
Response.Redirect("GetScopeList");
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult DeleteScope()
|
||||||
|
{
|
||||||
|
if (APIClient.User == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
return View(APIClient.GetRequest<List<ScopeViewModel>>($"api/scope/GetScopeList"));
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void DeleteScope(int scope)
|
||||||
|
{
|
||||||
|
if (APIClient.User == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали");
|
||||||
|
}
|
||||||
|
APIClient.PostRequest("api/scope/deletescope", new ScopeViewModel
|
||||||
|
{
|
||||||
|
Id = scope,
|
||||||
|
});
|
||||||
|
Response.Redirect("GetScopeList");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult GetMaterialsList()
|
||||||
|
{
|
||||||
|
|
||||||
|
return View(APIClient.GetRequest<List<MaterialViewModel>>($"api/material/getmateriallist"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult CreateMaterial()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void CreateMaterial(string name, double cost, int scopeId,int UserId)
|
||||||
|
{
|
||||||
|
if (APIClient.User == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали?");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(name))
|
||||||
|
{
|
||||||
|
throw new Exception("Название не указано");
|
||||||
|
}
|
||||||
|
if (cost <= 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Цена должна быть положительной");
|
||||||
|
}
|
||||||
|
APIClient.PostRequest("api/material/addmaterial", new MaterialBindingModel
|
||||||
|
{
|
||||||
|
Name = name,
|
||||||
|
Cost = cost,
|
||||||
|
ScopeId = scopeId,
|
||||||
|
UserId = UserId
|
||||||
|
});
|
||||||
|
Response.Redirect("GetMaterialsList");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult UpdateMaterial()
|
||||||
|
{
|
||||||
|
if (APIClient.User == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
return View(APIClient.GetRequest<List<MaterialViewModel>>($"api/material/GetMaterialList"));
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void UpdateMaterial(int material, string name, double cost, int scope, int user)
|
||||||
|
{
|
||||||
|
if (APIClient.User == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали?");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(name))
|
||||||
|
{
|
||||||
|
throw new Exception("Название не указано");
|
||||||
|
}
|
||||||
|
|
||||||
|
APIClient.PostRequest("api/material/updatematerial", new MaterialBindingModel
|
||||||
|
{
|
||||||
|
Id = material,
|
||||||
|
Name = name,
|
||||||
|
Cost = cost,
|
||||||
|
ScopeId = scope,
|
||||||
|
UserId = user
|
||||||
|
});
|
||||||
|
Response.Redirect("GetMaterialsList");
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult DeleteMaterial()
|
||||||
|
{
|
||||||
|
if (APIClient.User == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
return View(APIClient.GetRequest<List<MaterialViewModel>>($"api/material/GetMaterialList"));
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void DeleteMaterial(int material)
|
||||||
|
{
|
||||||
|
if (APIClient.User == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали");
|
||||||
|
}
|
||||||
|
APIClient.PostRequest("api/material/deletematerial", new MaterialBindingModel
|
||||||
|
{
|
||||||
|
Id = material,
|
||||||
|
});
|
||||||
|
Response.Redirect("GetMaterialsList");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,10 +1,12 @@
|
|||||||
|
using FurnitureAssemblyStoreKeeperClientApp;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
builder.Services.AddControllersWithViews();
|
builder.Services.AddControllersWithViews();
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
APIClient.Connect(builder.Configuration);
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
if (!app.Environment.IsDevelopment())
|
if (!app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,54 @@
|
|||||||
|
@using FurnitureAssemblyContracts.ViewModels
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Добавление материала";
|
||||||
|
var userList = APIClient.GetRequest<List<UserViewModel>>($"api/user/GetUserList");
|
||||||
|
var scopeList = APIClient.GetRequest<List<ScopeViewModel>>($"api/scope/GetScopeList");
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4">Добавление материала</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Название:</div>
|
||||||
|
<div class="col-8"><input type="text" name="name" id="name" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Стоимость:</div>
|
||||||
|
<div class="col-8"><input type="text" name="cost" id="cost" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Область применения:</div>
|
||||||
|
|
||||||
|
<div class="col-8">
|
||||||
|
<select name="scopeId">
|
||||||
|
<option value="0" disabled></option>
|
||||||
|
@foreach (var scope in scopeList)
|
||||||
|
{
|
||||||
|
<option value="@scope.Id">
|
||||||
|
@Html.DisplayFor(modelItem => scope.Name)
|
||||||
|
</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Производитель:</div>
|
||||||
|
|
||||||
|
<div class="col-8">
|
||||||
|
<select name="userID">
|
||||||
|
<option value="0" disabled></option>
|
||||||
|
@foreach (var user in userList)
|
||||||
|
{
|
||||||
|
<option value="@user.Id">
|
||||||
|
@Html.DisplayFor(modelItem => user.Name)
|
||||||
|
</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-8"></div>
|
||||||
|
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
|
||||||
|
</div>
|
||||||
|
</form>
|
@ -0,0 +1,18 @@
|
|||||||
|
@using FurnitureAssemblyContracts.ViewModels
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Добавление области";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4">Добавление области применения</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Название:</div>
|
||||||
|
<div class="col-8"><input type="text" name="name" id="name" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-8"></div>
|
||||||
|
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
@ -0,0 +1,27 @@
|
|||||||
|
@using FurnitureAssemblyContracts.ViewModels;
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Удаление области";
|
||||||
|
}
|
||||||
|
@model List<MaterialViewModel>
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4">Удаление материала</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Выбранный материал:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="material" name="material" class="form-control">
|
||||||
|
@foreach (var item in Model)
|
||||||
|
{
|
||||||
|
<option value="@item.Id">
|
||||||
|
@Html.DisplayFor(modelItem => item.Name)
|
||||||
|
</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-8"></div>
|
||||||
|
<div class="col-4"><input type="submit" value="Удалить" class="btn btn-primary" /></div>
|
||||||
|
</div>
|
||||||
|
</form>
|
@ -0,0 +1,27 @@
|
|||||||
|
@using FurnitureAssemblyContracts.ViewModels;
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Удаление области";
|
||||||
|
}
|
||||||
|
@model List<ScopeViewModel>
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4">Удаление области применения</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Выбранная область:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="scope" name="scope" class="form-control">
|
||||||
|
@foreach (var item in Model)
|
||||||
|
{
|
||||||
|
<option value="@item.Id">
|
||||||
|
@Html.DisplayFor(modelItem => item.Name)
|
||||||
|
</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-8"></div>
|
||||||
|
<div class="col-4"><input type="submit" value="Удалить" class="btn btn-primary" /></div>
|
||||||
|
</div>
|
||||||
|
</form>
|
@ -0,0 +1,5 @@
|
|||||||
|
@*
|
||||||
|
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||||
|
*@
|
||||||
|
@{
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
@using FurnitureAssemblyContracts.ViewModels
|
||||||
|
|
||||||
|
@model List<MaterialViewModel>
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Материалы";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
<h1 class="display-4">Материалы</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
@{
|
||||||
|
if (Model == null)
|
||||||
|
{
|
||||||
|
<h3 class="display-4">Авторизируйтесь</h3>
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<a asp-action="CreateMaterial">Создать</a>
|
||||||
|
<a asp-action="UpdateMaterial">Обновить</a>
|
||||||
|
<a asp-action="DeleteMaterial">Удалить</a>
|
||||||
|
</div>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Название
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Стоимость
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Область применения
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Изготовитель
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var item in Model)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Name)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Cost)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.ScopeName)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.UserName)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
}
|
||||||
|
</div>
|
@ -0,0 +1,47 @@
|
|||||||
|
@using FurnitureAssemblyContracts.ViewModels
|
||||||
|
|
||||||
|
@model List<ScopeViewModel>
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Области";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
<h1 class="display-4">Области применения</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
@{
|
||||||
|
if (Model == null)
|
||||||
|
{
|
||||||
|
<h3 class="display-4">Авторизируйтесь</h3>
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<a asp-action="CreateScope">Создать</a>
|
||||||
|
<a asp-action="UpdateScope">Обновить</a>
|
||||||
|
<a asp-action="DeleteScope">Удалить</a>
|
||||||
|
</div>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Название
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var item in Model)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Name)
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
}
|
||||||
|
</div>
|
@ -1,5 +1,7 @@
|
|||||||
@{
|
@using FurnitureAssemblyContracts.ViewModels;
|
||||||
ViewData["Title"] = "Register";
|
@model List<RoleViewModel>
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Регистрация";
|
||||||
}
|
}
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h2 class="display-4">Регистрация</h2>
|
<h2 class="display-4">Регистрация</h2>
|
||||||
@ -15,7 +17,22 @@ ViewData["Title"] = "Register";
|
|||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">ФИО:</div>
|
<div class="col-4">ФИО:</div>
|
||||||
<div class="col-8"><input type="text" name="fio" /></div>
|
<div class="col-8"><input type="text" name="name" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Роль:</div>
|
||||||
|
|
||||||
|
<div class="col-8">
|
||||||
|
<select name="roleId">
|
||||||
|
<option value="0" disabled></option>
|
||||||
|
@foreach (var role in Model)
|
||||||
|
{
|
||||||
|
<option value="@role.Id">
|
||||||
|
@Html.DisplayFor(modelItem => role.Name)
|
||||||
|
</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8"></div>
|
<div class="col-8"></div>
|
||||||
|
@ -0,0 +1,66 @@
|
|||||||
|
@using FurnitureAssemblyContracts.ViewModels
|
||||||
|
|
||||||
|
@model List<MaterialViewModel>
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Изменение материала";
|
||||||
|
var scopeList = APIClient.GetRequest<List<ScopeViewModel>>($"api/scope/GetScopeList");
|
||||||
|
var userList = APIClient.GetRequest<List<UserViewModel>>($"api/user/GetUserList");
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4">Изменение материала</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Материал:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="material" name="material" class="form-control">
|
||||||
|
@foreach (var item in Model)
|
||||||
|
{
|
||||||
|
<option value="@item.Id">
|
||||||
|
@Html.DisplayFor(modelItem => item.Name)
|
||||||
|
</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Название:</div>
|
||||||
|
<div class="col-8"><input type="text" name="name" id="name" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Стоимость:</div>
|
||||||
|
<div class="col-8"><input type="text" name="cost" id="cost" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-8"></div>
|
||||||
|
<div class="col-4"><input type="submit" value="Изменить" class="btn btn-primary" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Область применения:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="scope" name="scope" class="form-control">
|
||||||
|
@foreach (var item in scopeList)
|
||||||
|
{
|
||||||
|
<option value="@item.Id">
|
||||||
|
@Html.DisplayFor(modelItem => item.Name)
|
||||||
|
</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Производитель:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="user" name="user" class="form-control">
|
||||||
|
@foreach (var item in userList)
|
||||||
|
{
|
||||||
|
<option value="@item.Id">
|
||||||
|
@Html.DisplayFor(modelItem => item.Name)
|
||||||
|
</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
@ -0,0 +1,34 @@
|
|||||||
|
@using FurnitureAssemblyContracts.ViewModels
|
||||||
|
|
||||||
|
@model List<ScopeViewModel>
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Изменение области";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4">Изменение области применения</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Область применения:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="scope" name="scope" class="form-control">
|
||||||
|
@foreach (var item in Model)
|
||||||
|
{
|
||||||
|
<option value="@item.Id">
|
||||||
|
@Html.DisplayFor(modelItem => item.Name)
|
||||||
|
</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Название:</div>
|
||||||
|
<div class="col-8"><input type="text" name="name" id="name" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-8"></div>
|
||||||
|
<div class="col-4"><input type="submit" value="Изменить" class="btn btn-primary" /></div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
@ -28,15 +28,16 @@
|
|||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
|
else
|
||||||
<li class="nav-item">
|
{
|
||||||
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Мебель</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Мебель</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Материалы</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="GetMaterialsList">Материалы</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Области применения</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="GetScopeList">Области применения</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Отчеты</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Отчеты</a>
|
||||||
@ -44,6 +45,8 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||||
</li>
|
</li>
|
||||||
|
}
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,5 +6,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
|
|
||||||
"IPAddress": "https://localhost:7181"
|
"IPAddress": "https://localhost:7181"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user