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