예제 #1
0
        public ActionResult Create()
        {
            CategoryDao categoryDao = new CategoryDao();
            CountryDao  countryDao  = new CountryDao();

            ViewBag.Categories = categoryDao.GetAll();
            ViewBag.Countries  = countryDao.GetAll();
            return(View());
        }
예제 #2
0
        public void TestDeleteNotInUse()
        {
            Country country = _dataGenerator.CreateCountry();

            ICountryDao countryDao = new CountryDao(_graphClient);

            countryDao.Delete(country);

            Assert.AreEqual(0, countryDao.GetAll().Count);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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));
        }