コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }