Skip to content

Commit 9765f3f

Browse files
committed
product related update
1 parent b433d86 commit 9765f3f

File tree

6 files changed

+17
-8
lines changed

6 files changed

+17
-8
lines changed

src/BlazorEcommerce.Application/Features/Cart/Commands/AddToCart/AddToCartCommandHandler.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ public async Task<IResponse> Handle(AddToCartCommandRequest request, Cancellatio
3434
else
3535
{
3636
sameItem.Quantity += request.cartItem.Quantity;
37+
_command.CartItemCommand.Update(sameItem);
3738
}
38-
39+
3940
await _command.SaveAsync();
4041

4142
return new DataResponse<string?>(null);

src/BlazorEcommerce.Application/Features/Cart/Commands/UpdateQuantity/UpdateQuantityCommandHandler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public async Task<IResponse> Handle(UpdateQuantityCommandRequest request, Cancel
2929
}
3030

3131
dbCartItem.Quantity = request.cartItem.Quantity;
32+
_command.CartItemCommand.Update(dbCartItem);
3233
await _command.SaveAsync();
3334

3435
return new DataResponse<string?>(null);

src/BlazorEcommerce.Application/Features/Product/Command/DeleteProduct/DeleteProductCommandHandler.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace BlazorEcommerce.Application.Features.Product.Command.DeleteProduct;
1+
using BlazorEcommerce.Domain.Entities;
2+
3+
namespace BlazorEcommerce.Application.Features.Product.Command.DeleteProduct;
24

35
public record DeleteProductCommandRequest(int productId) : IRequest<IResponse>;
46

@@ -23,7 +25,7 @@ public async Task<IResponse> Handle(DeleteProductCommandRequest request, Cancell
2325
}
2426

2527
dbProduct.IsDeleted = true;
26-
28+
_command.ProductCommand.Update(dbProduct);
2729
await _command.SaveAsync();
2830

2931
return new DataResponse<string?>(null);

src/BlazorEcommerce.Application/Features/Product/Command/UpdateProduct/UpdateProductCommandHandler.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,11 @@ public async Task<IResponse> Handle(UpdateProductCommandRequest request, Cancell
5757
dbVariant.OriginalPrice = variant.OriginalPrice;
5858
dbVariant.IsActive = variant.IsActive;
5959
dbVariant.IsDeleted = variant.IsDeleted;
60+
_command.ProductVariantCommand.Update(dbVariant);
6061
}
6162
}
63+
64+
_command.ProductCommand.Update(dbProduct);
6265
await _command.SaveAsync();
6366

6467
return new DataResponse<ProductDto>(request.product, HttpStatusCodes.Accepted);

src/BlazorEcommerce.Application/MappingProfıles/ProductProfile.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ public class ProductProfile : Profile
66
{
77
public ProductProfile()
88
{
9-
CreateMap<Product, ProductDto>().ReverseMap();
9+
CreateMap<Product, ProductDto>()
10+
.ForMember(d => d.Variants, opt => opt.MapFrom(s => s.Variants))
11+
.ForMember(d => d.Images, opt => opt.MapFrom(s => s.Images))
12+
.ForMember(d => d.Category, opt => opt.MapFrom(s => s.Category))
13+
.ReverseMap();
14+
1015
CreateMap<ProductVariant, ProductVariantDto>().ReverseMap();
16+
CreateMap<Image, ImageDto>().ReverseMap();
1117
}
1218
}

src/Presentation/Shared/BlazorEcommerce.Shared.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,4 @@
1515
<ItemGroup>
1616
<SupportedPlatform Include="browser" />
1717
</ItemGroup>
18-
19-
<ItemGroup>
20-
<Folder Include="Payment\" />
21-
</ItemGroup>
2218
</Project>

0 commit comments

Comments
 (0)