public ActionResult Create(FormCollection collection) { LOGGER.Info("CategoryController::Create POST"); if (ModelState.IsValid) { try { Category category = new Category { //Id = Convert.ToInt32(collection["Id"]), Name = collection["Name"] }; category = categoryDao.SaveCategory(category); TempData["msg"] = "New category added"; TempData["css"] = "success"; return(RedirectToAction("Index")); } catch { return(View()); } } else { return(View()); } }