Пример #1
0
        public async Task AddPromoRewardRequest(PromoRewardRequestModel request)
        {
            var eventEntity = await _eventRepository.GetPureEvent(request.EventUid);

            var entity = new PromoRewardRequestEntity();

            entity.AccountingNumber       = request.AccountingNumber;
            entity.PromoRewardRequestUid  = Guid.NewGuid();
            entity.PromoRewardRequestTime = DateTime.UtcNow;
            entity.EventId = eventEntity.EventId;
            if (request.Images != null)
            {
                var images = new List <PromoRewardRequestImageContentEntity>();
                foreach (var image in request.Images)
                {
                    var imageUid = await _imageLogic.SaveImage(image);

                    images.Add(new PromoRewardRequestImageContentEntity {
                        PromoRewardRequestImageContentUid = imageUid
                    });
                }
                entity.Images = images;
            }
            await _eventRepository.AddPromoRewardRequest(entity);
        }