public ActionResult Create() { CategoryDao categoryDao = new CategoryDao(); CountryDao countryDao = new CountryDao(); ViewBag.Categories = categoryDao.GetAll(); ViewBag.Countries = countryDao.GetAll(); return(View()); }
public void TestDeleteNotInUse() { Country country = _dataGenerator.CreateCountry(); ICountryDao countryDao = new CountryDao(_graphClient); countryDao.Delete(country); Assert.AreEqual(0, countryDao.GetAll().Count); }
public void TestGetAll() { CountryDao dao = new CountryDao(_graphClient); Country created = _dataGenerator.CreateCountry(); IEnumerable <Country> allCountries = dao.GetAll(); Assert.AreEqual(1, allCountries.Count()); Assert.AreEqual(created.Name, allCountries.First().Name); Assert.AreEqual(created.Id, allCountries.First().Id); }
public void TestUpdate() { Country country = _dataGenerator.CreateCountry(); country.Name = "newname"; ICountryDao countryDao = new CountryDao(_graphClient); countryDao.Save(country); Assert.AreEqual("newname", countryDao.GetAll().First().Name); }
public void TestCreateAndReturn() { CountryDao dao = new CountryDao(_graphClient); Country newCountry = new Country() { Name = "Deutschland" }; Country created = dao.Create(newCountry); IEnumerable <Country> allCountries = dao.GetAll(); Assert.AreEqual(1, allCountries.Count()); Assert.AreEqual(created.Id, allCountries.First().Id); }
public ActionResult Edit(int productId) { ProductDao productDao = new ProductDao(); Product product = productDao.GetById(productId); CategoryDao categoryDao = new CategoryDao(); CountryDao countryDao = new CountryDao(); ViewBag.Categories = categoryDao.GetAll(); ViewBag.Countries = countryDao.GetAll(); TempData["tempProductId"] = productId; return(View(product)); }