Beispiel #1
0
        public void InsertCategory_Test()
        {
            CategroyViewModel categroy = new CategroyViewModel();

            categroy.Name = "Cloth";
            var result = categroyAppService.SaveNewCategroy(categroy);

            Assert.That(result, Is.True);
        }
        public ActionResult Create(CategroyViewModel newCategory)
        {
            if (!ModelState.IsValid)
            {
                return(View(newCategory));
            }

            bool result = categroyAppService.SaveNewCategroy(newCategory);

            if (result == false)
            {
                ViewBag.CategoryIsExist = true;
                return(View(newCategory));
            }
            ViewBag.CategoryIsExist = false;
            return(RedirectToAction("Index"));
        }