public ActionResult Index(int id) { var request = new GetVehiclesForCustomer() { CustomerId = id }; var response = mediator.Send(request).Result; var vehicles = response.Select(v => new Vehicle() { Id = v.Id, Brand = v?.Brand, LicenseNumber = v?.LicenseNumber, OwnerId = v.OwnerId, Type = v?.Type }); var view = new VehicleListViewModel() { OwnerId = id, Vehicle = vehicles }; return(View(view)); }
public ActionResult GetVehiclesForCustomer(GetVehiclesForCustomer command) { var response = mediator.Send(command); return(Ok(response)); }