public virtual async Task <int> AddAsync(TblPostAttributes record) { _dbContext.PostAttributes.Add(record); await _dbContext.SaveChangesAsync(); QueryCacheManager.ExpireTag(CacheTags.PostAttribute); _eventPublisher.EntityInserted(record); return(record.Id); }
public virtual async Task UpdateAsync(TblPostAttributes record) { var oldRecord = await FindByIdAsync(record.Id); _dbContext.PostAttributes.AddOrUpdate(record); await _dbContext.SaveChangesAsync(); QueryCacheManager.ExpireTag(CacheTags.PostAttribute); _eventPublisher.EntityUpdated(record, oldRecord); }
public virtual async Task <PostAttributeModel> PreparePostAttributeModelAsync(TblPostAttributes attribute) { PostAttributeModel result; if (attribute == null) { result = new PostAttributeModel(); } else { result = attribute.Adapt <PostAttributeModel>(); await attribute.LoadAllLocalizedStringsToModelAsync(result); } return(result); }