исправление ошибки привязки 2 балла из-за нее потерял ААААААА

This commit is contained in:
Мк Игорь 2023-05-28 20:14:12 +04:00
parent 6ae1f4a9e7
commit 0de4faadaa
4 changed files with 1 additions and 16 deletions

View File

@ -296,23 +296,8 @@ namespace CarServiceWebApp.Controllers
}
[HttpPost]
public IActionResult Attachment(int id, int selecteditem, int count)
{
var existingAttachment = _itemForRepairLogic.ReadElement(new() { ItemId = selecteditem });
if (existingAttachment == null)
{
_itemForRepairLogic.Create(new() { ItemId = selecteditem, RepairRequestId = id, Count = count });
}
else
{
existingAttachment.Count = count;
_itemForRepairLogic.Update(new()
{
Id = existingAttachment.Id,
Count = existingAttachment.Count,
ItemId = existingAttachment.ItemId,
RepairRequestId = existingAttachment.RepairRequestId
});
}
return Redirect($"~/Home/RepairRequest/{id}");
}
[HttpGet]