// [ValidateAntiForgeryToken()] public ActionResult Create(Chocolate chocolate) { chocolateRepository.AddChocolate(chocolate); TempData["Message"] = "Chocolate added successfully!"; try { if (ModelState.IsValid) { Categories categories = new Categories(); categories.CategorieId = chocolate.CategorieId; List <Categories> categories = ChocolateBL.DownDrop(); ViewBag.categories = new SelectList(categories, "CategorieId", "Name"); CategorieBL.CreateCategories(); return(RedirectToAction("GetChocolateDetails")); } } catch { View("Error"); } return(RedirectToAction("Index")); }
public AnnounceController() { announceBL = new AnnounceBL(); categoryBL = new CategorieBL(); }