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 SpecialGetAllResponse GetAllSpecials() { var response = new SpecialGetAllResponse(); response.Specials = Repo.GetSpecials(); if (!response.Specials.Any()) { response.Success = false; response.Message = "Could not load any vehicles"; } else { response.Success = true; } return(response); }
public ActionResult Specials() { //get manager SpecialManager manager = SpecialManagerFactory.Create(); //get response SpecialGetAllResponse response = manager.GetAllSpecials(); //validate if (!response.Success) { return(new HttpStatusCodeResult(500, $"Error in cloud. Message: {response.Message}")); } else { //create vm SpecialListVM model = new SpecialListVM(); model.SetSpecialItems(response.Specials); return(View(model)); } }