using Microsoft.AspNetCore.Mvc;
using Shride.Models;
using System.Threading.Tasks;

namespace Shride.Components
{
    public class RideDetailViewComponent : ViewComponent
    {
        private IRideRepository repository;

        public RideDetailViewComponent(IRideRepository repo)
        {
            repository = repo;
        }

        public IViewComponentResult Invoke(int id)
        {
            var ride = repository.GetRide(id);
            return View("RideDetail", ride);
        }
    }
}
