Example #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);
     }
 }
Example #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;
     }
 }
Example #3
0
 public bool UpdateSetup(Setup model)
 {
     try
     {
         _setup.Update(model);
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #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);
        }
Example #5
0
 public bool CreateOrUpdate(Category model)
 {
     return(!string.IsNullOrWhiteSpace(model.CategoryId)
         ? _category.Update(model) > 0
         : _category.Insert(model) > 0);
 }
Example #6
0
 public bool UpdateSetup(Setup model)
 {
     return(_setup.Update(model) > 0);
 }