コード例 #1
0
ファイル: HomeController.cs プロジェクト: ANOVCHEROV/lab6_aov
 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"));
            }
        }