//public IViewComponentResult Invoke()
        //{
        //    var makes = _makeRepo.GetAll().ToList();
        //    if (!makes.Any())
        //    {
        //        return new ContentViewComponentResult("Unable to get the makes");
        //    }

        //    return View("MenuView", makes);
        //}
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var makes = await _serviceWrapper.GetMakesAsync();

            if (makes == null)
            {
                return(new ContentViewComponentResult("Unable to get the makes"));
            }
            return(View("MenuView", makes));
        }
예제 #2
0
 internal async Task <SelectList> GetMakesAsync()
 => new SelectList(await _serviceWrapper.GetMakesAsync(), nameof(Make.Id), nameof(Make.Name));