//GET: Shop public ActionResult Index(IEnumerable <ShopDisplayVM> shops, int idSort) { var user = _userLogic.GetUserByEMail(System.Web.HttpContext.Current.User.Identity.Name.ToString()) ?? new Common.User(); ViewData["UserRole"] = _userLogic.GetRoleUser(user.IDUser); ViewData["IDUser"] = user.IDUser; ViewData["Sort"] = idSort; List <SelectListItem> nameShops = new List <SelectListItem>(); List <SelectListItem> descriptionShops = new List <SelectListItem>(); foreach (Shop i in _shopLogic.GetShops()) { nameShops.Add(new SelectListItem { Text = i.NameShop.ToString(), Value = i.NameShop.ToString() }); descriptionShops.Add(new SelectListItem { Text = i.DescriptionShop.ToString(), Value = i.DescriptionShop.ToString() }); } ViewData["NameShop"] = nameShops; ViewData["Description"] = descriptionShops; return(View(shops)); }
public void GetShops() { var oldShop = new Common.Shop() { NameShop = "Lime", PhoneShop = "+7909323232", City = "Saratov" }; int id = logic.AddShop(oldShop); var shops = logic.GetShops(); Assert.IsNotNull(shops.GetEnumerator()); int count = 0; foreach (Common.Shop s in shops) { count++; } Assert.AreEqual(count, 1); }