Example #1
0
        public override async Task <Event> AddAsync(Event entity)
        {
            //EntityCreationCache
            var res = (await RepositoryDbSet.AddAsync(EventMapper.MapFromDAL(entity))).Entity;

            EntityCreationCache.Add(res.Id, res);
            return(EventMapper.MapFromDomain(res));
        }
Example #2
0
        public async Task <int?> AddAsync(DALReceiptDTO receiptDTO)
        {
            var receipt     = ReceiptMapper.FromDAL(receiptDTO);
            var addedEntity = (await RepoDbSet.AddAsync(receipt)).Entity;

            if (addedEntity == null)
            {
                return(null);
            }
            EntityCreationCache.Add(addedEntity.Id, addedEntity);
            return(addedEntity.Id);
        }
        /// <summary>
        /// Adds row
        /// </summary>
        /// <param name="row"></param>
        /// <param name="userId"></param>
        /// <returns>receiptRowId</returns>
        public async Task <int?> AddAsync(DALReceiptRowDTO row)
        {
            var receiptRow = ReceiptRowMapper.FromDAL(row);

            if (receiptRow == null)
            {
                return(null);
            }

            var receiptEntity = (await RepoDbSet.AddAsync(receiptRow)).Entity;

            EntityCreationCache.Add(receiptEntity.Id, receiptEntity);

            return(receiptEntity.Id);
        }