Пример #1
0
        public IActionResult ListResturent()
        {
            List <ListOfResturantVM> listOfs = new List <ListOfResturantVM>();

            var vendor = _listOfAll.GetVendor();

            if (vendor != null)
            {
                foreach (var item in vendor)
                {
                    if (item.Category.Name == "Restaurants")
                    {
                        ListOfResturantVM resturantVM = new ListOfResturantVM();
                        resturantVM.Category         = item.Category.Name;
                        resturantVM.Id               = item.Id;
                        resturantVM.StoreName        = item.StoreName;
                        resturantVM.UniqueFileName   = item.UniqueFileName;
                        resturantVM.Website_Url      = item.Website_Url;
                        resturantVM.Address_Location = item.Address_Location;
                        listOfs.Add(resturantVM);
                    }
                }
            }

            return(View(listOfs));
        }
Пример #2
0
        public IActionResult ListResturentByArea(string Area)
        {
            var data = _listOfAll.GetAreaByName(Area);

            ViewBag.AreaName = Area;
            List <ListOfResturantVM> listOfs = new List <ListOfResturantVM>();

            if (data != null)
            {
                foreach (var item in data.VendorWithAreas)
                {
                    var vendor = _listOfAll.GetVendorById(item.VendorId ?? 0);
                    if (vendor.Category.Name == "Restaurants")
                    {
                        ListOfResturantVM resturantVM = new ListOfResturantVM();
                        resturantVM.Category         = vendor.Category.Name;
                        resturantVM.Id               = vendor.Id;
                        resturantVM.StoreName        = vendor.StoreName;
                        resturantVM.UniqueFileName   = vendor.UniqueFileName;
                        resturantVM.Website_Url      = vendor.Website_Url;
                        resturantVM.Address_Location = vendor.Address_Location;
                        listOfs.Add(resturantVM);
                    }
                }
            }

            return(View(listOfs));
        }