Exemple #1
0
        /// <summary>
        /// Get's the data needed by the Stores action.
        /// </summary>
        /// <param name="repo"></param>
        /// <returns>List of all stores</returns>
        private static List <StoreViewModel> LoadandRetrieveStoreData(IDbRepository repo)
        {
            List <StoreViewModel> stores = new List <StoreViewModel>();

            foreach (var x in repo.GetLocations().ToList())
            {
                repo.GetOrderHistory(x);

                stores.Add(StoreToViewMapper.MapLocationToStore(x));
            }

            return(stores);
        }
Exemple #2
0
        //GET: Store/Details?&store=store
        public ActionResult Details([FromServices] IDbRepository repo, string store)
        {
            if (!string.IsNullOrWhiteSpace(store))
            {
                var s = repo.GetLocation(store);

                if (s.LocationOrderHistory.Count() == 0)
                {
                    repo.GetOrderHistory(s);
                }

                var viewModel = StoreToViewMapper.MapLocationToStore(s);

                return(View(viewModel));
            }
            else
            {
                ModelState.AddModelError("BadName", "Bad store name given");
                return(RedirectToAction("Stores"));
            }
        }