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)); }
public IActionResult DeleteVendor(int VendorID) { var vendor = _listOfAll.GetVendor().Where(x => x.Id == VendorID).FirstOrDefault();; _efRepository.Delete(vendor); _efRepository.SaveChanges(); return(RedirectToAction("Index", "ManageAllUser")); }
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)); }