Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
use mapper for create product in catalog service
  • Loading branch information
alirezasariri78 committed Sep 18, 2024
commit 45c9df394572535e5b54c0dc4ad4694e9fe234de
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,7 @@ public async Task<CreateProductResult> Handle(CreateProductCommand command, Canc
//create Product entity from command object
//save to database
//return CreateProductResult result

var product = new Product
{
Name = command.Name,
Category = command.Category,
Description = command.Description,
ImageFile = command.ImageFile,
Price = command.Price
};

var product = command.Adapt<Product>();
//save to database
session.Store(product);
await session.SaveChangesAsync(cancellationToken);
Expand Down