Esempio n. 1
0
 public bool Add(Article article)
 {
     try
     {
         article.CreateDateTime = _dateAndTime.Get();
         article.ModifyDateTime = _dateAndTime.Get();
         _cmsEntities.Articles.Add(article);
         _cmsEntities.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="category"></param>
 /// <returns></returns>
 public bool Add(Category category)
 {
     try
     {
         category.CreateDateTime = _dateAndTime.Get();
         category.ModifyDateTime = _dateAndTime.Get();
         _cmsEntities.Categories.Add(category);
         _cmsEntities.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
 }