Example #1
0
        public virtual async Task UpdateAsync(TblProductDiscountsForUserGroups record)
        {
            var oldRecord = await FindByIdAsync(record.Id);

            _dbContext.ProductDiscountsForUserGroups.AddOrUpdate(record);
            await _dbContext.SaveChangesAsync();

            QueryCacheManager.ExpireTag(CacheTags.ProductDiscountForUserGroup);

            _eventPublisher.EntityUpdated(record, oldRecord);
        }
Example #2
0
        public virtual async Task <int> AddAsync(TblProductDiscountsForUserGroups record)
        {
            _dbContext.ProductDiscountsForUserGroups.Add(record);
            await _dbContext.SaveChangesAsync();

            QueryCacheManager.ExpireTag(CacheTags.ProductDiscountForUserGroup);

            _eventPublisher.EntityInserted(record);

            return(record.Id);
        }
Example #3
0
        public virtual ProductDiscountsForUserGroupsModel PrepareProductDiscountsForUserGroupsModel(TblProductDiscountsForUserGroups record, int productId)
        {
            var result = record == null
                ? new ProductDiscountsForUserGroupsModel()
                : record.Adapt <ProductDiscountsForUserGroupsModel>();

            result.ProductId = productId;
            return(result);
        }