示例#1
0
 public ActionResult Create([Bind(Exclude = "ID")] Animals records)
 {
     try
     {
         records.AddingDate = DateTime.Now;
         if (recordsDAO.AddRecord(records))
         {
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View("Create"));
         }
     }
     catch (Exception ex)
     {
         return(RedirectToAction("Error", new { ErrorText = ex.Message }));
     }
 }
示例#2
0
        public ActionResult Create([Bind(Exclude = "Id")] Records records)
        {
            try
            {
                if (recordsDAO.AddRecord(records))
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View("Create"));
                }
            }
            catch

            {
                return(View("Create"));
            }
        }