..." />
return View(car);
}
[HttpPost("363239")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Delete(int id, Car car)
{
await _serviceWrapper.DeleteCarAsync(id,car);
return RedirectToAction(nameof(Index));
}
Обновление компонента представления
В текущий момент внутри компонента представления MenuViewComponent применяется уровень доступа к данным и синхронная версия Invoke(). Внесите в класс следующие изменения:
using System.Linq;
using System.Threading.Tasks;
using AutoLot.Dal.Repos.Interfaces;
using AutoLot.Services.ApiWrapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ViewComponents;
namespace AutoLot.Mvc.ViewComponents
{
public class MenuViewComponent : ViewComponent
{
private readonly IApiServiceWrapper _serviceWrapper;
public MenuViewComponent(IApiServiceWrapper serviceWrapper)
{
_serviceWrapper = serviceWrapper;
}
public async Task<IViewComponentResult> InvokeAsync()
{
var makes = await _serviceWrapper.GetMakesAsync();
if (makes == null)