public async Task <IViewComponentResult> InvokeAsync(int id) { List <RentalProperty> properties = null; if (id == 0) { properties = RentalsManager.GetAll(); } else { properties = RentalsManager.GetAllbyPropertyType(id); } // transformation to View Model var rentals = properties.Select(p => new RenterViewModel { Address = p.Address, City = p.City, Id = p.Id, Owner = p.Owner.Name, PropertyType = p.PropertyType.Style, Province = p.Province, Rent = p.Rent.ToString() }).ToList(); return(View(rentals)); }
public IActionResult Properties(int id) { // go to the rental manager, get all the rentals of this properties types var filteredRentals = RentalsManager.GetAllbyPropertyType(id); var result = $"Property Count: {filteredRentals.Count}"; return(Content(result)); }