public void PreTestingInitialize() { category_mock.Setup(x => x.List()).Returns(new Category[] { new Category() { NameEn = "Green",ID=1 }, new Category() { NameEn = "Blue", ID=2 } }); Subcategory[] sub = new Subcategory[] { new Subcategory() { NameEn = "LG",ID=1 }, new Subcategory() { NameEn = "Nokia", ID=2 } }; }
public ActionResult Create(Subcategory subcategory) { if (ModelState.IsValid) { subcategoryRepository.Insert(subcategory); subcategoryRepository.Save(); return RedirectToAction("Index"); } else { return View(); } }
public void Insert(Subcategory subcategory) { entities.Subcategories.Add(subcategory); }