fix даунской ошибки
This commit is contained in:
parent
cc3abca889
commit
7be10126db
@ -19,6 +19,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SoftwareInstallationDatabas
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoftwareInstallationRestApi", "SoftwareInstallationRestApi\SoftwareInstallationRestApi.csproj", "{68CE709E-067B-4745-8893-B082C86A1FAB}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoftwareInstallationClientApp", "SoftwareInstallationClientApp\SoftwareInstallationClientApp.csproj", "{69FE812F-D1F0-4A4F-9844-C1E0212AC607}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -57,6 +59,10 @@ Global
|
||||
{68CE709E-067B-4745-8893-B082C86A1FAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{68CE709E-067B-4745-8893-B082C86A1FAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{68CE709E-067B-4745-8893-B082C86A1FAB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{69FE812F-D1F0-4A4F-9844-C1E0212AC607}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{69FE812F-D1F0-4A4F-9844-C1E0212AC607}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{69FE812F-D1F0-4A4F-9844-C1E0212AC607}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{69FE812F-D1F0-4A4F-9844-C1E0212AC607}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -28,9 +28,9 @@ namespace SoftwareInstallationClientApp
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(result);
|
||||
}
|
||||
}
|
||||
throw new Exception(result);
|
||||
}
|
||||
}
|
||||
|
||||
public static void PostRequest<T>(string requestUrl, T model)
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ namespace SoftwareInstallationClientApp.Controllers
|
||||
[HttpGet]
|
||||
public IActionResult Create()
|
||||
{
|
||||
ViewBag.Pastries = APIClient.GetRequest<List<PackageViewModel>>("api/main/getpackagelist");
|
||||
ViewBag.Packages = APIClient.GetRequest<List<PackageViewModel>>("api/main/getpackagelist");
|
||||
return View();
|
||||
}
|
||||
|
||||
|
@ -6,4 +6,12 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SoftwareInstallationContracts\SoftwareInstallationContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<div class="row">
|
||||
<div class="col-4">Изделие:</div>
|
||||
<div class="col-8">
|
||||
<select id="package" name="package" class="form-control" asp-items="@(new SelectList(@ViewBag.Pastries, "Id", "PackageName"))"></select>
|
||||
<select id="package" name="package" class="form-control" asp-items="@(new SelectList(@ViewBag.Packages, "Id", "PackageName"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
@ -6,5 +6,5 @@
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"IPAddress": "http://localhost:5011"
|
||||
"IPAddress": "http://localhost:5044"
|
||||
}
|
@ -12,7 +12,7 @@ namespace SoftwareInstallationDatabaseImplement.Implements
|
||||
public OrderViewModel? Delete(OrderBindingModel model)
|
||||
{
|
||||
using var context = new SoftwareInstallationDatabase();
|
||||
var element = context.Orders.FirstOrDefault(x => x.Id == model.Id);
|
||||
var element = context.Orders.Include(x => x.Client).FirstOrDefault(x => x.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Orders.Remove(element);
|
||||
@ -30,7 +30,8 @@ namespace SoftwareInstallationDatabaseImplement.Implements
|
||||
return null;
|
||||
}
|
||||
return context.Orders
|
||||
.Include(x => x.Package)
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.Package)
|
||||
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
|
||||
@ -65,7 +66,8 @@ namespace SoftwareInstallationDatabaseImplement.Implements
|
||||
{
|
||||
using var context = new SoftwareInstallationDatabase();
|
||||
return context.Orders
|
||||
.Include(x => x.Package)
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.Package)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -86,7 +88,7 @@ namespace SoftwareInstallationDatabaseImplement.Implements
|
||||
public OrderViewModel? Update(OrderBindingModel model)
|
||||
{
|
||||
using var context = new SoftwareInstallationDatabase();
|
||||
var order = context.Orders.Include(x => x.Package).FirstOrDefault(x => x.Id == model.Id);
|
||||
var order = context.Orders.Include(x => x.Client).Include(x => x.Package).FirstOrDefault(x => x.Id == model.Id);
|
||||
if (order == null)
|
||||
{
|
||||
return null;
|
||||
|
@ -16,7 +16,7 @@ builder.Services.AddTransient<IPackageStorage, PackageStorage>();
|
||||
|
||||
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
||||
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
||||
builder.Services.AddTransient<IPackageStorage, PackageStorage>();
|
||||
builder.Services.AddTransient<IPackageLogic, PackageLogic>();
|
||||
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<log4net>
|
||||
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
|
||||
<file value="c:/temp/AbstractShopRestApi.log" />
|
||||
<file value="c:/temp/SoftwareInstallationRestApi.log" />
|
||||
<appendToFile value="true" />
|
||||
<maximumFileSize value="100KB" />
|
||||
<maxSizeRollBackups value="2" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user