예제 #1
0
        public async Task AddFeedback(FeedbackModel model, Guid uid)
        {
            var entity       = _mapper.Map <FeedbackEntity>(model);
            var personEntity = await _personRepository.GetPerson(uid);

            entity.PersonId     = personEntity.PersonId;
            entity.FeedbackTime = DateTime.UtcNow;
            entity.FeedbackUid  = Guid.NewGuid();
            if (model.Images != null)
            {
                var images = new List <FeedbackImageContentEntity>();
                foreach (var image in model.Images)
                {
                    var imageUid = await _imageLogic.SaveImage(image);

                    images.Add(new FeedbackImageContentEntity {
                        FeedbackImageContentUid = imageUid
                    });
                }
                entity.FeedbackImageContentEntities = images;
            }
            await _personRepository.AddFeedback(entity);
        }