Beispiel #1
0
 public void CreateOrUpdate(Article model)
 {
     if (string.IsNullOrWhiteSpace(model.Summary))
     {
         var summaryLength = model.SummarySize > model.Content.Length ? model.Content.Length : model.SummarySize;
         model.Summary = model.Content.Substring(0, summaryLength);
     }
     if (!string.IsNullOrWhiteSpace(model.ArticleId))
     {
         _article.Update(model);
     }
     else
     {
         model.ArticleId = Helper.CreateGuidWithNoSplit();
         _article.Insert(model);
     }
 }
Beispiel #2
0
 public bool CreateOrUpdate(Category model)
 {
     try
     {
         if (!string.IsNullOrWhiteSpace(model.CategoryId))
         {
             _category.Update(model);
         }
         else
         {
             _category.Insert(model);
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #3
0
 public bool UpdateSetup(Setup model)
 {
     try
     {
         _setup.Update(model);
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #4
0
        public bool CreateOrUpdate(Article model)
        {
            var result = false;

            try
            {
                if (!string.IsNullOrWhiteSpace(model.ArticleId))
                {
                    _article.Update(model);
                }
                else
                {
                    _article.Insert(model);
                }
                result = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(result);
        }
Beispiel #5
0
 public bool CreateOrUpdate(Category model)
 {
     return(!string.IsNullOrWhiteSpace(model.CategoryId)
         ? _category.Update(model) > 0
         : _category.Insert(model) > 0);
 }
Beispiel #6
0
 public bool UpdateSetup(Setup model)
 {
     return(_setup.Update(model) > 0);
 }