Skip to content

First push#98

Open
DSills735 wants to merge 14 commits into
the-csharp-academy:mainfrom
DSills735:main
Open

First push#98
DSills735 wants to merge 14 commits into
the-csharp-academy:mainfrom
DSills735:main

Conversation

@DSills735
Copy link
Copy Markdown

Ive finished the base with 2/3 challenges. As you can tell, I am working on the frontend. I just wanted to submit the api to make sure I was on the right track.

Copy link
Copy Markdown

@chrisjamiecarter chrisjamiecarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @DSills735 👋,

❓ Is this project submission ready?

I can see no files to review.

Thanks 👍,
@chrisjamiecarter

@DSills735
Copy link
Copy Markdown
Author

Not really sure how that happened. It should be good to go now. Im still not finished with the frontend.

@DSills735
Copy link
Copy Markdown
Author

@chrisjamiecarter

Copy link
Copy Markdown

@chrisjamiecarter chrisjamiecarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @DSills735 👋,

I have not reviewed yet as just opened the solution and there are already issues.

🔧 Next Steps

  • Please fix any 🔴 items, as they block approval.
  • Commit and push your changes, then leave me a comment when done.
  • Feel free to reach out if you have any questions or want to discuss further 🆘.

Thanks,
@chrisjamiecarter 👍

@@ -0,0 +1,4 @@
<Solution>
<Project Path="Sills.GolfShop.eCommerce/Sills.GolfShop.eCommerceAPI.csproj" />
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Project Does Not Build

💡 Solution file (.slnx) references incorrect folder paths

Image

@DSills735
Copy link
Copy Markdown
Author

Thats what I get for making last second changes without testing them... silly me. @chrisjamiecarter It builds now.

Copy link
Copy Markdown

@chrisjamiecarter chrisjamiecarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @DSills735 👋,

Excellent work on your Ecommerce API project submission 🎉!

I have performed a peer review against the C# Academy requirements. Review/ignore any comments as you wish.


What You Did Well 🟢

  1. ✅ Solid project structure with proper separation between API and Frontend projects
  2. ✅ Good use of Dependency Injection throughout (Program.cs services)
  3. ✅ Entity Framework Core implementation with proper DbContext
  4. ✅ Many-to-many relationship correctly implemented with ProductSales junction table
  5. ✅ Soft deletes implemented with DeletedAt field on Product and Categories
  6. ✅ Price field excluded from ProductUpdateDto (requirement met)

Areas for Improvement 🟠

  • blocking async calls (.Result, .Wait()) - Should use await throughout to prevent thread blocking
  • pagination bugs - GetProducts and GetSales both calculate pagination but return unpaged results

🔧 Next Steps

  • Please fix any 🔴 items, as they block approval.
  • Commit and push your changes, then leave me a comment when done.
  • Feel free to reach out if you have any questions or want to discuss further 🆘.

Thanks,
@chrisjamiecarter 👍

Comment thread eCommerceApi.dsills735/Sills.GolfShop.eCommerce/Controllers/ProductController.cs Outdated
Comment thread eCommerceApi.dsills735/Sills.GolfShop.eCommerce/Controllers/ProductController.cs Outdated
Comment thread eCommerceApi.dsills735/Sills.GolfShop.eCommerce/Controllers/ProductController.cs Outdated
Comment thread eCommerceApi.dsills735/Sills.GolfShop.eCommerce/Controllers/ProductController.cs Outdated
Comment thread eCommerceApi.dsills735/Sills.GolfShop.eCommerce/Controllers/ProductController.cs Outdated
{
return await _context.Sales.ToListAsync();
}
public async Task<Sales> GetSaleByIdAsync(int id)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public async Task<Sales> GetSaleByIdAsync(int id)
public async Task<Sale?> GetSaleByIdAsync(int id)

Comment on lines +61 to +76
public async Task AddProductToSaleAsync(int saleId, int productId)
{
var sale = await _context.Sales.FindAsync(saleId);
var product = await _context.Products.FindAsync(productId);
if (sale == null || product == null)
{
return;
}
var productSale = new ProductSales
{
Sale = sale,
Product = product
};
_context.ProductSales.Add(productSale);
await _context.SaveChangesAsync();
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 No Confirmation of Result

💡 How do you know whether this succeeded or not? Maybe return a bool?

Suggested change
public async Task AddProductToSaleAsync(int saleId, int productId)
{
var sale = await _context.Sales.FindAsync(saleId);
var product = await _context.Products.FindAsync(productId);
if (sale == null || product == null)
{
return;
}
var productSale = new ProductSales
{
Sale = sale,
Product = product
};
_context.ProductSales.Add(productSale);
await _context.SaveChangesAsync();
}
public async Task<bool> AddProductToSaleAsync(int saleId, int productId)
{
var sale = await _context.Sales.FindAsync(saleId);
var product = await _context.Products.FindAsync(productId);
if (sale == null || product == null)
{
return false;
}
var productSale = new ProductSales
{
Sale = sale,
Product = product
};
_context.ProductSales.Add(productSale);
return await _context.SaveChangesAsync() > 0;
}

Comment thread eCommerceApi.dsills735/Sills.GolfShop.eCommerce/Program.cs Outdated
Comment thread eCommerceApi.dsills735/Sills.GolfShop.eCommerce/Program.cs Outdated
Comment thread eCommerceApi.dsills735/Sills.GolfShop.eCommerce/Sills.GolfShop.eCommerce.http Outdated
@DSills735
Copy link
Copy Markdown
Author

Hello again @chrisjamiecarter . I have updated the project, and believe my revisions are complete. I went ahead and removed the frontend as I am not finished with it yet.

Copy link
Copy Markdown

@chrisjamiecarter chrisjamiecarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @DSills735 👋 ,

Code updates look good. For some reason I cannot perform a review...

Please ensure you go through all my previous comments and take my advise onboard!

See you in the next one. I will approve this.

Thanks,
@chrisjamiecarter 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants