예제 #1
0
        public ActionResult AddItemToDb(Item addMe)
        {
            bool success;

            if (ModelState.IsValid)
            {
                success = DAO.AddItem(addMe);
            }
            else
            {
                success = false;
            }

            if (!success)
            {
                TempData["ErrorMessage"] = "There is already an item with this name in the database.";
            }
            return(RedirectToAction("Index"));
        }