так симпатичнее
This commit is contained in:
parent
1aca0b53bb
commit
55a9363a09
@ -264,7 +264,7 @@ namespace HardwareShopStorekeeperApp.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateComponent(string name, string cost, DateTime date)
|
||||
public void CreateComponent(string name, string cost)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
@ -282,8 +282,7 @@ namespace HardwareShopStorekeeperApp.Controllers
|
||||
{
|
||||
UserId = APIClient.User.Id,
|
||||
ComponentName = name,
|
||||
Cost = Convert.ToDouble(cost.Replace('.', ',')),
|
||||
DateCreate = date
|
||||
Cost = Convert.ToDouble(cost.Replace('.', ','))
|
||||
});
|
||||
Response.Redirect("Components");
|
||||
}
|
||||
|
@ -16,10 +16,6 @@
|
||||
<label class="form-label">Стоимость</label>
|
||||
<input type="number" step="0.01" class="form-control" name="cost" min="0.01" required>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<label class="form-label">Дата приобретения</label>
|
||||
<input type="datetime-local" class="form-control" name="date" required>
|
||||
</div>
|
||||
<div class="col-sm-2 d-flex justify-content-evenly align-items-baseline">
|
||||
<button type="submit" class="btn btn-primary mt-3 px-4">Сохранить</button>
|
||||
</div>
|
||||
|
@ -90,8 +90,8 @@ namespace HardwareShopDatabaseImplement.Implements.Worker
|
||||
var build = context.Builds
|
||||
.Include(x => x.Purchases)
|
||||
.ThenInclude(x => x.Purchase)
|
||||
.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (build == null || build.UserId != build.UserId)
|
||||
.FirstOrDefault(x => x.Id == model.Id && x.UserId == model.UserId);
|
||||
if (build == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -124,8 +124,8 @@ namespace HardwareShopDatabaseImplement.Implements.Worker
|
||||
var purchase = context.Purchases
|
||||
.Include(x => x.Goods)
|
||||
.ThenInclude(x => x.Good)
|
||||
.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (purchase == null || purchase.UserId != model.UserId)
|
||||
.FirstOrDefault(x => x.Id == model.Id && x.UserId == model.UserId);
|
||||
if (purchase == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user