Skip to content

Commit

Permalink
feat: add create product command
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikoo-Asadnejad committed Feb 25, 2024
1 parent 60b7315 commit b390a92
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Src/Product.Application/Product.Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
</PropertyGroup>

<ItemGroup>
<Folder Include="Commands" />
<Folder Include="Handlers" />
<Folder Include="Queries" />
<PackageReference Include="MediatR" Version="12.1.1" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="MediatR" Version="12.1.1" />
<Folder Include="Category\Commands" />
<Folder Include="Category\Queries" />
<Folder Include="Product\Queries" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using MediatR;

namespace Product.Application.Product.Commands;

public class CreateProductCommand : IRequest
{
public CreateProductCommand(string title,
decimal price,
string subTitle = default,

Check warning on line 9 in Src/Product.Application/Product/Commands/CreateProduct/CreateProductCommand.cs

View workflow job for this annotation

GitHub Actions / build

Cannot convert null literal to non-nullable reference type.
string description = default,

Check warning on line 10 in Src/Product.Application/Product/Commands/CreateProduct/CreateProductCommand.cs

View workflow job for this annotation

GitHub Actions / build

Cannot convert null literal to non-nullable reference type.
int categoryId = default)
{
Title = title;
SubTitle = subTitle;
Description = description;
Price = price;
CategoryId = categoryId;
}

public string Title { get; private set; }
public string? SubTitle { get; private set; }
public string? Description { get; private set; }
public decimal Price { get; private set; }
public int CategoryId { get; private set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using MediatR;

namespace Product.Application.Product.Commands;

public sealed class CreateProductCommandHandler : IRequestHandler<CreateProductCommand>
{
public Task Handle(CreateProductCommand request, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Product.Application.Product.Commands;

public class CreateProductCommandValidator
{

}

0 comments on commit b390a92

Please sign in to comment.