Esempio n. 1
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));
        }
        public IActionResult List()
        {
            var data = _userManger.Users.ToList();
            List <SignUpVendorVM> model = new List <SignUpVendorVM>();

            if (data != null)
            {
                foreach (var item in data)
                {
                    if (_userManger.IsInRoleAsync(item, "Vendor").Result)
                    {
                        var            VendorData = _listOfAll.GetVendorById(item.Id);
                        SignUpVendorVM listVM     = new SignUpVendorVM();
                        listVM.Id          = item.Id;
                        listVM.FirstName   = item.FirstName;
                        listVM.LastName    = item.LastName;
                        listVM.Email       = item.Email;
                        listVM.PhoneNumber = item.PhoneNumber;
                        listVM.StoreName   = VendorData.StoreName;
                        listVM.Address     = VendorData.Address_Location;
                        model.Add(listVM);
                    }
                }
            }

            return(View(model));
        }
Esempio n. 3
0
        public async Task <IActionResult> Index()
        {
            var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
            var user   = await _userManger.FindByIdAsync(userId);

            var data = _userManger.Users.ToList();

            if (_userManger.IsInRoleAsync(user, "admin").Result)
            {
                data = _userManger.Users.ToList();
            }
            else
            {
                data = _userManger.Users.Where(x => x.UserName == user.UserName).ToList();
            }
            List <SignUpVendorVM> model = new List <SignUpVendorVM>();

            if (data != null)
            {
                foreach (var item in data)
                {
                    if (_userManger.IsInRoleAsync(item, "Vendor").Result)
                    {
                        if (_listOfAll.GetVendor().Where(x => x.UserId == item.Id).Any())
                        {
                            var            VendorData = _listOfAll.GetVendorById(item.Id);
                            SignUpVendorVM listVM     = new SignUpVendorVM();
                            listVM.Id          = item.Id;
                            listVM.FirstName   = item.FirstName;
                            listVM.LastName    = item.LastName;
                            listVM.Email       = item.Email;
                            listVM.PhoneNumber = item.PhoneNumber;
                            listVM.StoreName   = VendorData.StoreName;
                            listVM.Address     = VendorData.Address_Location;
                            listVM.VendorID    = VendorData.Id;

                            model.Add(listVM);
                        }
                    }
                }
            }

            return(View(model));
        }