示例#1
0
 public ActionResult Create(int id = -1)
 {
     try
     {
         Category category = null;
         try
         {
             category = CategoryRepository.Get(id);
         }
         catch (ArgumentNullException)
         {
         }
         var model = ArticleFactory.CreateArticleViewModelWithDefValues(category);
         return(View(model));
     }
     catch (Exception ex)
     {
         Log.Error(ex);
         return(RedirectToAction("Index", "Error"));
     }
 }
        public ActionResult Create(int id = -1)
        {
            try
            {
                Category category = null;
                try
                {
                    category = CategoryRepository.Get(id);
                }
#pragma warning disable CC0004 // Catch block cannot be empty
                catch (ArgumentNullException)
                {
                }
#pragma warning restore CC0004 // Catch block cannot be empty

                var model = ArticleFactory.CreateArticleViewModelWithDefValues(category);
                return(View(model));
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                return(RedirectToAction("Index", "Error"));
            }
        }