Compare commits
2 Commits
34990e1436
...
749f04230f
Author | SHA1 | Date | |
---|---|---|---|
749f04230f | |||
189b4573bc |
@ -11,7 +11,8 @@ namespace CarCenterContracts.BindingModels
|
||||
public class FeatureBindingModel : IFeatureModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public HelpDevices HelpDevice { get; set; } = HelpDevices.Неизвестно;
|
||||
public int StorekeeperId { get; set; }
|
||||
public HelpDevices HelpDevice { get; set; } = HelpDevices.Неизвестно;
|
||||
public string CabinColor { get; set; } = string.Empty;
|
||||
public DriveTypes DriveType { get; set; } = DriveTypes.Неизвестно;
|
||||
public double Price { get; set; }
|
||||
|
@ -9,5 +9,6 @@ namespace CarCenterContracts.SearchModels
|
||||
public class FeatureSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
public int? StorekeeperId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,8 @@ namespace CarCenterContracts.ViewModels
|
||||
public class FeatureViewModel : IFeatureModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Вспомогательные устройства")]
|
||||
public int StorekeeperId { get; set; }
|
||||
[DisplayName("Вспомогательные устройства")]
|
||||
public HelpDevices HelpDevice { get; set; }
|
||||
[DisplayName("Цвет салона")]
|
||||
public string CabinColor { get; set; } = string.Empty;
|
||||
|
@ -27,7 +27,7 @@ namespace CarCenterDatabaseImplement.Implements
|
||||
{
|
||||
return context.Bundlings
|
||||
.Where(x => x.StorekeeperId == model.StorekeeperId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
return new();
|
||||
|
@ -24,10 +24,10 @@ namespace CarCenterDatabaseImplement.Implements
|
||||
public List<FeatureViewModel> GetFilteredList(FeatureSearchModel model)
|
||||
{
|
||||
using var context = new CarCenterDatabase();
|
||||
if (model.Id.HasValue)
|
||||
if (model.StorekeeperId.HasValue)
|
||||
{
|
||||
return context.Features
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Where(x => x.StorekeeperId == model.StorekeeperId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace CarCenterDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(CarCenterDatabase))]
|
||||
[Migration("20240528131936_InitialCreate2")]
|
||||
partial class InitialCreate2
|
||||
[Migration("20240528143805_InitialCreate3")]
|
||||
partial class InitialCreate3
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
@ -146,6 +146,9 @@ namespace CarCenterDatabaseImplement.Migrations
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<int>("StorekeeperId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Features");
|
@ -6,7 +6,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace CarCenterDatabaseImplement.Migrations
|
||||
{
|
||||
public partial class InitialCreate2 : Migration
|
||||
public partial class InitialCreate3 : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
@ -33,6 +33,7 @@ namespace CarCenterDatabaseImplement.Migrations
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
StorekeeperId = table.Column<int>(type: "integer", nullable: false),
|
||||
HelpDevice = table.Column<int>(type: "integer", nullable: false),
|
||||
CabinColor = table.Column<string>(type: "text", nullable: false),
|
||||
DriveType = table.Column<int>(type: "integer", nullable: false),
|
@ -144,6 +144,9 @@ namespace CarCenterDatabaseImplement.Migrations
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<int>("StorekeeperId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Features");
|
||||
|
@ -16,7 +16,8 @@ namespace CarCenterDatabaseImplement.Models
|
||||
public class Feature : IFeatureModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
[Required]
|
||||
public int StorekeeperId { get; set; }
|
||||
[Required]
|
||||
public HelpDevices HelpDevice { get; set; } = HelpDevices.Неизвестно;
|
||||
[Required]
|
||||
public string CabinColor { get; set; } = string.Empty;
|
||||
@ -40,6 +41,7 @@ namespace CarCenterDatabaseImplement.Models
|
||||
CabinColor = model.CabinColor,
|
||||
DriveType = model.DriveType,
|
||||
Price = model.Price,
|
||||
StorekeeperId = model.StorekeeperId,
|
||||
};
|
||||
}
|
||||
public static Feature Create(FeatureViewModel model)
|
||||
@ -47,6 +49,7 @@ namespace CarCenterDatabaseImplement.Models
|
||||
return new Feature
|
||||
{
|
||||
Id = model.Id,
|
||||
StorekeeperId = model.StorekeeperId,
|
||||
HelpDevice = model.HelpDevice,
|
||||
CabinColor = model.CabinColor,
|
||||
DriveType = model.DriveType,
|
||||
@ -59,6 +62,7 @@ namespace CarCenterDatabaseImplement.Models
|
||||
{
|
||||
return;
|
||||
}
|
||||
StorekeeperId = model.StorekeeperId;
|
||||
HelpDevice = model.HelpDevice;
|
||||
CabinColor = model.CabinColor;
|
||||
DriveType = model.DriveType;
|
||||
@ -67,6 +71,7 @@ namespace CarCenterDatabaseImplement.Models
|
||||
public FeatureViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
StorekeeperId = StorekeeperId,
|
||||
HelpDevice = HelpDevice,
|
||||
CabinColor = CabinColor,
|
||||
DriveType = DriveType,
|
||||
|
@ -112,12 +112,63 @@ namespace CarCenterStorekeeperApp.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_data.UpdateBundling(model))
|
||||
model.StorekeeperId = UserStorekeeper.user!.Id;
|
||||
if (_data.UpdateBundling(model))
|
||||
return RedirectToAction("IndexBundling");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
[HttpGet]
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult IndexFeature()
|
||||
{
|
||||
if (UserStorekeeper.user != null)
|
||||
{
|
||||
var list = _data.GetFeatures(UserStorekeeper.user.Id);
|
||||
if (list != null)
|
||||
return View(list);
|
||||
return View(new List<FeatureViewModel>());
|
||||
}
|
||||
return RedirectToAction("IndexNonReg");
|
||||
}
|
||||
[HttpPost]
|
||||
public void IndexFeature(int id)
|
||||
{
|
||||
if (UserStorekeeper.user != null)
|
||||
{
|
||||
_data.DeleteFeature(id);
|
||||
}
|
||||
Response.Redirect("IndexFeature");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult CreateFeature(int id)
|
||||
{
|
||||
if (id != 0)
|
||||
{
|
||||
var value = _data.GetFeature(id);
|
||||
if (value != null)
|
||||
return View(value);
|
||||
}
|
||||
return View(new FeatureViewModel());
|
||||
}
|
||||
[HttpPost]
|
||||
public IActionResult CreateFeature(FeatureBindingModel model)
|
||||
{
|
||||
if (model.Id == 0)
|
||||
{
|
||||
model.StorekeeperId = UserStorekeeper.user!.Id;
|
||||
if (_data.CreateFeature(model))
|
||||
return RedirectToAction("IndexFeature");
|
||||
}
|
||||
else
|
||||
{
|
||||
model.StorekeeperId = UserStorekeeper.user!.Id;
|
||||
if (_data.UpdateFeature(model))
|
||||
return RedirectToAction("IndexFeature");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
if (IsLoggedIn)
|
||||
|
@ -11,20 +11,14 @@ namespace StorekeeperApp
|
||||
private readonly ILogger _logger;
|
||||
private readonly IStorekeeperLogic _storekeeperLogic;
|
||||
private readonly IBundlingLogic _bundlingLogic;
|
||||
/* private readonly IProductionLogic _productionLogic;
|
||||
private readonly IProductLogic _productLogic;
|
||||
private readonly IMachineLogic _machineLogic;
|
||||
private readonly IWorkshopLogic _workshopLogic;*/
|
||||
private readonly IFeatureLogic _featureLogic;
|
||||
|
||||
public StorekeeperData(ILogger<StorekeeperData> logger, IStorekeeperLogic storekeeperLogic, IBundlingLogic bundlingLogic/* IProductionLogic productionLogic, IProductLogic productLogic, IMachineLogic machineLogic, IWorkshopLogic workshopLogic*/)
|
||||
public StorekeeperData(ILogger<StorekeeperData> logger, IStorekeeperLogic storekeeperLogic, IBundlingLogic bundlingLogic, IFeatureLogic featureLogic)
|
||||
{
|
||||
_logger = logger;
|
||||
_storekeeperLogic = storekeeperLogic;
|
||||
_bundlingLogic = bundlingLogic;
|
||||
/* _productionLogic = productionLogic;
|
||||
_productLogic = productLogic;
|
||||
_machineLogic = machineLogic;
|
||||
_workshopLogic = workshopLogic;*/
|
||||
_featureLogic = featureLogic;
|
||||
}
|
||||
|
||||
public StorekeeperViewModel? Login(string email, string password)
|
||||
@ -64,90 +58,27 @@ namespace StorekeeperApp
|
||||
{
|
||||
return _bundlingLogic.ReadElement(new() { Id = id });
|
||||
}
|
||||
public List<FeatureViewModel>? GetFeatures(int userId)
|
||||
{
|
||||
return _featureLogic.ReadList(new FeatureSearchModel() { StorekeeperId = userId });
|
||||
}
|
||||
public bool DeleteFeature(int bundlingId)
|
||||
{
|
||||
return _featureLogic.Delete(new() { Id = bundlingId });
|
||||
}
|
||||
public bool CreateFeature(FeatureBindingModel model)
|
||||
{
|
||||
return _featureLogic.Create(model);
|
||||
}
|
||||
public bool UpdateFeature(FeatureBindingModel model)
|
||||
{
|
||||
return _featureLogic.Update(model);
|
||||
}
|
||||
public FeatureViewModel? GetFeature(int id)
|
||||
{
|
||||
return _featureLogic.ReadElement(new() { Id = id });
|
||||
}
|
||||
|
||||
|
||||
/*public List<ProductViewModel>? GetProducts(int userId)
|
||||
{
|
||||
return _productLogic.ReadList(new ProductSearchModel() { UserId = userId });
|
||||
}
|
||||
public ProductViewModel? GetProduct(int id)
|
||||
{
|
||||
return _productLogic.ReadElement(new() { Id = id });
|
||||
}
|
||||
public bool UpdateProduct(ProductBindingModel model)
|
||||
{
|
||||
return _productLogic.Update(model);
|
||||
}
|
||||
public bool DeleteProduct(int productId)
|
||||
{
|
||||
return _productLogic.Delete(new() { Id = productId });
|
||||
}
|
||||
public bool CreateProduct(ProductBindingModel model)
|
||||
{
|
||||
return _productLogic.Create(model);
|
||||
}
|
||||
|
||||
public List<ProductionViewModel>? GetProductions(int userId)
|
||||
{
|
||||
return _productionLogic.ReadList(new() { UserId = userId });
|
||||
}
|
||||
public ProductionViewModel? GetProduction(int id)
|
||||
{
|
||||
return _productionLogic.ReadElement(new() { Id = id });
|
||||
}
|
||||
public bool CreateProduction(ProductionBindingModel model)
|
||||
{
|
||||
return _productionLogic.Create(model);
|
||||
}
|
||||
public bool UpdateProduction(ProductionBindingModel model)
|
||||
{
|
||||
return _productionLogic.Update(model);
|
||||
}
|
||||
public bool DeleteProduction(int productionId)
|
||||
{
|
||||
return _productionLogic.Delete(new() { Id = productionId });
|
||||
}
|
||||
|
||||
public List<MachineViewModel>? GetMachines()
|
||||
{
|
||||
return _machineLogic.ReadList(null);
|
||||
}
|
||||
|
||||
public List<BundlingTimeReport> GetTimeReport(DateTime? startDate, DateTime? endDate, int UserId)
|
||||
{
|
||||
var bundlings = _bundlingLogic.ReadList(new() { DateFrom = startDate, DateTo = endDate, UserId = UserId });
|
||||
if (bundlings == null)
|
||||
return new();
|
||||
List<BundlingTimeReport> bundlingTimeReports = new List<BundlingTimeReport>();
|
||||
foreach (var bundling in bundlings)
|
||||
{
|
||||
var report = new BundlingTimeReport();
|
||||
report.BundlingName = bundling.Name;
|
||||
var products = _productLogic.ReadList(new() { BundlingId = bundling.Id, UserId = UserId });
|
||||
if (products != null)
|
||||
report.Products = products.Select(p => p.Name).ToList();
|
||||
var productions = _productionLogic.ReadList(new() { BundlingId = bundling.Id, UserId = UserId });
|
||||
if (productions != null)
|
||||
report.Productions = productions.Select(p => p.Name).ToList();
|
||||
bundlingTimeReports.Add(report);
|
||||
}
|
||||
return bundlingTimeReports;
|
||||
}
|
||||
|
||||
public List<BundlingWorkshopReportViewModel>? GetWorkshopReports(List<int> bundlings)
|
||||
{
|
||||
List<BundlingWorkshopReportViewModel> reports = new();
|
||||
foreach (int i in bundlings)
|
||||
{
|
||||
BundlingWorkshopReportViewModel report = new();
|
||||
var bundling = _bundlingLogic.ReadElement(new() { Id = i });
|
||||
report.BundlingName = bundling!.Name;
|
||||
var workshops = _workshopLogic.ReadList(new() { BundlingId = i });
|
||||
if (workshops != null)
|
||||
report.WorkShops = workshops.Select(w => w.Title).ToList();
|
||||
reports.Add(report);
|
||||
}
|
||||
return reports;
|
||||
}*/
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,61 +0,0 @@
|
||||
@using CarCenterContracts.ViewModels;
|
||||
@using CarCenterDataModels.Enums;
|
||||
@{
|
||||
ViewData["Title"] = "CarCreate";
|
||||
}
|
||||
|
||||
<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 name="brandType" id="brandType">
|
||||
@foreach (var value in Enum.GetValues(typeof(CarBrand)))
|
||||
{
|
||||
<option value="@value">@value</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Модель:</div>
|
||||
<div class="col-8"><input type="text" name="model" id="model" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Марка:</div>
|
||||
<div class="col-8">
|
||||
<select name="carClass" id="carClass">
|
||||
@foreach (var value in Enum.GetValues(typeof(CarClass)))
|
||||
{
|
||||
<option value="@value">@value</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8">Особенность:</div>
|
||||
<!--Без реализации логики четко не ясно что тут писать-->
|
||||
<select id="feature" name="feature" class="form-control" asp-items="@(new SelectList(@ViewBag.Features,"Id"))"></select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Год:</div>
|
||||
<div class="col-8"><input type="text" name="year" id="year" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Вин-номер:</div>
|
||||
<div class="col-8"><input type="text" name="vin" id="vin" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Цена:</div>
|
||||
<div class="col-8"><input type="text" name="price" id="price" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4"></div>
|
||||
<div class="col-2"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
|
||||
<div class="col-4"></div>
|
||||
<div class="col-2"><input type="button" value="Отменить" class="btn btn-secondary" /></div>
|
||||
</div>
|
||||
</form>
|
@ -1,19 +0,0 @@
|
||||
@{
|
||||
ViewData["Title"] = "CarDelete";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Удалить машину</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<select id="car" name="car" class="form-control" asp-items="@(new SelectList(@ViewBag.Cars,"Id"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4"></div>
|
||||
<div class="col-2"><input type="submit" value="Удалить" class="btn btn-primary" /></div>
|
||||
<div class="col-4"></div>
|
||||
<div class="col-2"><input type="button" value="Отменить" class="btn btn-secondary" /></div>
|
||||
</div>
|
||||
</form>
|
@ -1,67 +0,0 @@
|
||||
@using CarCenterContracts.ViewModels;
|
||||
@using CarCenterDataModels.Enums;
|
||||
@{
|
||||
ViewData["Title"] = "CarUpdate";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Обновление машины</h2>
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
<div class="row mb-3">
|
||||
<div class="col-4">Машина</div>
|
||||
<div class="col-8">
|
||||
<select id="car" name="car" class="form-control" asp-items="@(new SelectList(@ViewBag.Cars,"Id"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Марка:</div>
|
||||
<div class="col-8">
|
||||
<select name="brandType" id="brandType">
|
||||
@foreach (var value in Enum.GetValues(typeof(CarBrand)))
|
||||
{
|
||||
<option value="@value">@value</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Модель:</div>
|
||||
<div class="col-8"><input type="text" name="model" id="model" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Марка:</div>
|
||||
<div class="col-8">
|
||||
<select name="carClass" id="carClass">
|
||||
@foreach (var value in Enum.GetValues(typeof(CarClass)))
|
||||
{
|
||||
<option value="@value">@value</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8">Особенность:</div>
|
||||
<!--Без реализации логики четко не ясно что тут писать-->
|
||||
<select id="feature" name="feature" class="form-control" asp-items="@(new SelectList(@ViewBag.Features,"Id"))"></select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Год:</div>
|
||||
<div class="col-8"><input type="text" name="year" id="year" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Вин-номер:</div>
|
||||
<div class="col-8"><input type="text" name="vin" id="vin" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Цена:</div>
|
||||
<div class="col-8"><input type="text" name="price" id="price" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4"></div>
|
||||
<div class="col-2"><input type="submit" value="Обновить" class="btn btn-primary" /></div>
|
||||
<div class="col-4"></div>
|
||||
<div class="col-2"><input type="button" value="Отменить" class="btn btn-secondary" /></div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,83 @@
|
||||
@using CarCenterContracts.ViewModels;
|
||||
@using CarCenterDataModels.Enums;
|
||||
|
||||
@model FeatureViewModel;
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "CreateFeature";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Особенность</h2>
|
||||
</div>
|
||||
<form id="featureForm" method="post">
|
||||
<input type="text" name="id" id="id" value="@Model.Id" hidden="hidden" />
|
||||
<div class="row">
|
||||
<div class="col-4">Вспомогательные устройства:</div>
|
||||
<div class="col-8">
|
||||
<select name="HelpDevice" id="HelpDevice" value="@Model.HelpDevice">
|
||||
@foreach (var value in Enum.GetValues(typeof(HelpDevices)))
|
||||
{
|
||||
<option value="@value">@value</option>
|
||||
}
|
||||
</select>
|
||||
<span id="HelpDeviceError" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Тип привода:</div>
|
||||
<div class="col-8">
|
||||
<select name="DriveType" id="DriveType" value="@Model.DriveType">
|
||||
@foreach (var value in Enum.GetValues(typeof(DriveTypes)))
|
||||
{
|
||||
<option value="@value">@value</option>
|
||||
}
|
||||
</select>
|
||||
<span id="DriveTypeeError" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Цвет салона:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="CabinColor" id="CabinColor" value="@Model.CabinColor" />
|
||||
<span id="CabinColorError" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Цена:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="Price" id="Price" value="@Model.Price" />
|
||||
<span id="PriceError" class="text-danger"></span>
|
||||
</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>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#bundlinglForm').submit(function (event) {
|
||||
var HelpDevice = $('#HelpDevice').val();
|
||||
var CabinColor = $('#CabinColor').val();
|
||||
var DriveType = $('#DriveType').val();
|
||||
var Price = $('#Price').val();
|
||||
var isValid = true;
|
||||
|
||||
$('#PriceError').text('');
|
||||
$('#HelpDeviceError').text('');
|
||||
$('#CabinColorError').text('');
|
||||
$('#DriveTypeError').text('');
|
||||
|
||||
if (isNaN(price) || cost <= 0) {
|
||||
$('#PriceError').text('Цена должна быть положительным числом.');
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
if (!isValid) {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
@ -1,46 +0,0 @@
|
||||
@using CarCenterContracts.ViewModels;
|
||||
@using CarCenterDataModels.Enums;
|
||||
@{
|
||||
ViewData["Title"] = "FeatureCreate";
|
||||
}
|
||||
|
||||
<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 name="helpDevice" id="helpDevice">
|
||||
@foreach (var value in Enum.GetValues(typeof(HelpDevices)))
|
||||
{
|
||||
<option value="@value">@value</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Цвет салона:</div>
|
||||
<div class="col-8"><input type="text" name="cabinColor" id="cabinColor" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Тип привода:</div>
|
||||
<div class="col-8">
|
||||
<select name="driveType" id="driveType>
|
||||
@foreach (var value in Enum.GetValues(typeof(DriveTypes)))
|
||||
{
|
||||
<option value="@value">@value</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Цена:</div>
|
||||
<div class="col-8"><input type="text" name="price" id="price" /></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>
|
@ -1,16 +0,0 @@
|
||||
@{
|
||||
ViewData["Title"] = "FeatureDelete";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Удалить особенность</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<select id="feature" name="feature" class="form-control" asp-items="@(new SelectList(@ViewBag.Features,"Id"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Удалить" class="btn btn-danger" />
|
||||
</div>
|
||||
</form>
|
@ -1,52 +0,0 @@
|
||||
<!-- Страница обновления особенности. Самой логики нет, она будет в 3 этапе курсовой работы, поэтому пока так. -->
|
||||
@using CarCenterDataModels.Enums;
|
||||
@{
|
||||
ViewData["Title"] = "FeatureUpdate";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Обновление особенности</h2>
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
<div class="row mb-3">
|
||||
<div class="col-4">Особенность</div>
|
||||
<div class="col-8">
|
||||
<select id="feature" name="feature" class="form-control" asp-items="@(new SelectList(@ViewBag.Features,"Id"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Вспомогательные устройства:</div>
|
||||
<div class="col-8">
|
||||
<select name="helpDevice" id="helpDevice">
|
||||
@foreach (var value in Enum.GetValues(typeof(HelpDevices)))
|
||||
{
|
||||
<option value="@value">@value</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Цвет салона:</div>
|
||||
<div class="col-8"><input type="text" name="cabinColor" id="cabinColor" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Тип привода:</div>
|
||||
<div class="col-8">
|
||||
<select name="druveType" id="driveType>
|
||||
@foreach (var value in Enum.GetValues(typeof(DriveTypes)))
|
||||
{
|
||||
<option value="@value">@value</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Цена:</div>
|
||||
<div class="col-8"><input type="text" name="price" id="price" /></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>
|
@ -1,60 +0,0 @@
|
||||
@using CarCenterContracts.ViewModels;
|
||||
@model List<FeatureViewModel>
|
||||
@{
|
||||
ViewData["Title"] = "Features";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Особенность</h1>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
@{
|
||||
if (Model == null)
|
||||
{
|
||||
<h2 class="display-4">Надо войти в аккаунт.</h2>
|
||||
return;
|
||||
}
|
||||
<p>
|
||||
<a class="text-decoration-none me-3 text-black h5" asp-action="Create">Создать особенность</a>
|
||||
<a class="text-decoration-none me-3 text-black h5" asp-action="Update">Изменить особенность</a>
|
||||
<a class="text-decoration-none text-black h5" asp-action="Delete">Удалить особенность</a>
|
||||
</p>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Вспомогательные устройства
|
||||
</th>
|
||||
<th>
|
||||
Цвет салона
|
||||
</th>
|
||||
<th>
|
||||
Тип привода
|
||||
</th>
|
||||
<th>
|
||||
Цена
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var feature in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => feature.HelpDevice)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => feature.CabinColor)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => feature.DriveType)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => feature.Price)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
@ -6,8 +6,7 @@
|
||||
<h1 class="display-4">Главное меню</h1>
|
||||
<div class="list-group">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="IndexBundling">Комплектации</a>
|
||||
@* <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="IndexProduct">Изделия</a>
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="IndexProduction">Производства</a> *@
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="IndexFeature">Особенности</a>
|
||||
<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="ReportsMenu">Меню отчетов</a> *@
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Logout">Выйти</a>
|
||||
|
@ -0,0 +1,82 @@
|
||||
@using CarCenterContracts.ViewModels;
|
||||
|
||||
@model List<FeatureViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Features";
|
||||
}
|
||||
|
||||
<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 asp-action="CreateFeature" asp-route-id="0">Создать особенность</a>
|
||||
</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Номер
|
||||
</th>
|
||||
<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.HelpDevice)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.CabinColor)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.DriveType)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Price)
|
||||
</td>
|
||||
<td>
|
||||
<a asp-action="CreateFeature" asp-route-id="@item.Id" class="btn btn-primary">Изменить</a>
|
||||
</td>
|
||||
<td>
|
||||
<form method="post">
|
||||
<input type="text" title="id" name="id" value="@item.Id" hidden="hidden" />
|
||||
<input type="submit" class="btn btn-danger" value="Удалить" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user