public virtual async Task UpdateAsync(TblPostTags record) { var oldRecord = await FindByIdAsync(record.Id); _dbContext.PostTags.AddOrUpdate(record); await _dbContext.SaveChangesAsync(); QueryCacheManager.ExpireTag(CacheTags.PostTag); _eventPublisher.EntityUpdated(record, oldRecord); }
public virtual async Task <int> AddAsync(TblPostTags record) { record.Tag = record.Tag.Trim(); if (!string.IsNullOrWhiteSpace(record.Tag)) { _dbContext.PostTags.Add(record); await _dbContext.SaveChangesAsync(); QueryCacheManager.ExpireTag(CacheTags.PostTag); _eventPublisher.EntityInserted(record); } return(record.Id); }
public virtual async Task <PostTagModel> PreparePostTagModelAsync(TblPostTags tag) { PostTagModel result; if (tag == null) { result = new PostTagModel(); } else { result = tag.Adapt <PostTagModel>(); await tag.LoadAllLocalizedStringsToModelAsync(result); } return(result); }