теперь 1 метод на всё и на это, и на это, и на это, и на то
This commit is contained in:
parent
e4e9447a0b
commit
256f8f98af
@ -3,6 +3,7 @@ using HardwareShopDatabaseImplement.Models.ManyToMany;
|
||||
using HardwareShopDatabaseImplement.Models.Storekeeper;
|
||||
using HardwareShopDatabaseImplement.Models.Worker;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace HardwareShopDatabaseImplement
|
||||
{
|
||||
@ -10,7 +11,7 @@ namespace HardwareShopDatabaseImplement
|
||||
{
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=Computer_Hardware_Store1;Username=user;Password=12345");
|
||||
optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=Computer_Hardware_Store4;Username=postgres;Password=1234");
|
||||
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||
}
|
||||
|
||||
|
@ -49,12 +49,12 @@ namespace HardwareShopRestApi.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public List<PurchaseViewModel>? GetPurchases(int userId)
|
||||
[HttpPost]
|
||||
public List<PurchaseViewModel>? GetPurchases(PurchaseSearchModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _purchaseLogic.ReadList(new() { UserId = userId });
|
||||
return _purchaseLogic.ReadList(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -327,7 +327,7 @@ namespace HardwareShopWorkerApp.Controllers
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.GetRequest<List<PurchaseViewModel>>($"api/purchase/getpurchases?userId={APIClient.User.Id}"));
|
||||
return View(APIClient.PostRequestWithResult<PurchaseSearchModel, List<PurchaseViewModel>>($"api/purchase/getpurchases", new() { UserId = APIClient.User.Id }));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@ -358,7 +358,8 @@ namespace HardwareShopWorkerApp.Controllers
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Purchases = APIClient.GetRequest<List<PurchaseViewModel>>($"api/purchase/getpurchases?userId={APIClient.User.Id}");
|
||||
|
||||
ViewBag.Purchases = APIClient.PostRequestWithResult<PurchaseSearchModel, List<PurchaseViewModel>> ($"api/purchase/getpurchases", new() {UserId = APIClient.User.Id });
|
||||
return View();
|
||||
}
|
||||
|
||||
@ -521,8 +522,8 @@ namespace HardwareShopWorkerApp.Controllers
|
||||
if (buildId <= 0)
|
||||
{
|
||||
throw new Exception($"Идентификтаор сборки не может быть ниже или равен 0");
|
||||
}
|
||||
ViewBag.Purchase = APIClient.GetRequest<List<PurchaseViewModel>>($"api/purchase/GetPurchasesNotDelivery?userId={APIClient.User.Id}");
|
||||
}
|
||||
ViewBag.Purchases = APIClient.PostRequestWithResult<PurchaseSearchModel, List<PurchaseViewModel>>($"api/purchase/getpurchases", new() { UserId = APIClient.User.Id, PurchaseStatus = PurchaseStatus.Выполняется });
|
||||
return View(APIClient.GetRequest<List<Tuple<PurchaseViewModel, int>>>($"api/build/GetBuildPurchase?buildId={buildId}"));
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<label class="form-label">Покупка</label>
|
||||
<select id="purchaseId" name="purchaseId" class="form-control" asp-items="@(new SelectList(@ViewBag.Purchase, "Id","Id"))"></select>
|
||||
<select id="purchaseId" name="purchaseId" class="form-control" asp-items="@(new SelectList(@ViewBag.Purchases, "Id","Id"))"></select>
|
||||
<div class="form-group">
|
||||
<label>Количество</label>
|
||||
<input type="number" class="form-control" required="required" name="count" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user