public override async Task <ProductDto> Add(AddedProductDto request, ServerCallContext context) { var product = request.ToProduct(); await _productApplication.AddProduct(product); return(product.ToProductDto()); }
public static Product ToProduct(this AddedProductDto dto) { return(new Product(dto.Name, dto.Description, (decimal)Math.Round(dto.UnitPrice, 2))); }