public ActionResult NewCategory(Category category) { try { if (ModelState.IsValid) //check of de modelstate goed is { using (DatabaseQuery query = new DatabaseQuery()) { query.CreateCategory(category); return RedirectToAction("index"); //Laat de Admin zien als het goed gaat } } } catch (Exception error) { ModelState.AddModelError("Product is niet toegevoegd aan de Database", error); //Adds a model error to the errors collection for the model-state dictionary. } return RedirectToAction("AddCategory", category); }