Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }