public virtual async Task <int> AddAsync(TblPostDescriptions record) { _dbContext.PostDescriptions.Add(record); await _dbContext.SaveChangesAsync(); QueryCacheManager.ExpireTag(CacheTags.PostDescription); _eventPublisher.EntityInserted(record); return(record.Id); }
public virtual async Task UpdateAsync(TblPostDescriptions record) { var oldRecord = await FindByIdAsync(record.Id); _dbContext.PostDescriptions.AddOrUpdate(record); await _dbContext.SaveChangesAsync(); QueryCacheManager.ExpireTag(CacheTags.PostDescription); _eventPublisher.EntityUpdated(record, oldRecord); }
public virtual async Task <PostDescriptionModel> PreparePostDescriptionModelAsync(TblPostDescriptions description, int postId) { PostDescriptionModel result; if (description == null) { result = new PostDescriptionModel(); } else { result = description.Adapt <PostDescriptionModel>(); await description.LoadAllLocalizedStringsToModelAsync(result); } result.PostId = postId; return(result); }