示例#1
0
        public async Task <string> CreateAsync(string creatorId, string productId, ReviewInputModel inputModel)
        {
            this.ThrowIfIncorrectId(_context.Products, productId);

            var review = inputModel.Map <ReviewInputModel, Review>();

            review.CreatedOn = DateTime.UtcNow;
            review.ProductId = productId;
            review.CreatorId = creatorId;

            _context.Reviews.Add(review);

            await _context.SaveChangesAsync();

            return(review.Id);
        }