public ProductReview(AddProductReview command) { this.ProductId = command.ProductId; this.ReviewerName = command.ReviewerName; this.EmailAddress = command.EmailAddress; this.Rating = command.Rating; this.Comments = command.Comments; this.ReviewDate = DateTime.UtcNow; this.ModifiedDate = DateTime.UtcNow; }
public static void Handle(CommandContext commandContext, AddProductReview command) { var productReview = new ProductReview(command); commandContext.DbContext.Set <ProductReview>().Add(productReview); }