public ActionResult Index() { //get managers ListingManager listingManager = ListingManagerFactory.Create(); SpecialManager specialManager = SpecialManagerFactory.Create(); //get responses ListingFeaturedResponse listingFeaturedResponse = listingManager.GetFeaturedListings(); SpecialGetAllResponse specialResponse = specialManager.GetAllSpecials(); //validate responses if (!listingFeaturedResponse.Success || !specialResponse.Success) { return(new HttpStatusCodeResult(500, $"Error in cloud. Message:{listingFeaturedResponse.Message} {specialResponse.Message}")); } else { //build vm HomeVM model = new HomeVM(); model.SetFeaturedListingItems(listingFeaturedResponse.Listings); model.SetSpecialItems(specialResponse.Specials); return(View(model)); } }
public ListingFeaturedResponse GetFeaturedListings() { var response = new ListingFeaturedResponse(); response.Listings = Repo.GetFeaturedListings(); if (!response.Listings.Any()) { response.Success = false; response.Message = "Could not load any vehicles"; } else { response.Success = true; } return(response); }