Skip to content

This project is a Web API for managing a product catalog and user reviews, developed in C# using .NET Web API.

Notifications You must be signed in to change notification settings

ioanTeulea/.Net-Web-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project Name: .NET WEB API

Description:

This project is a Web API for managing a product catalog and user reviews, developed in C# using .NET Web API. It follows best practices of RESTful API development to ensure scalability and maintainability.

.Net Web API

📌 Features:

  • CRUD Operations: Manage products and reviews.
  • Authentication & Authorization: Secure API endpoints with JWT authentication and role-based access control.
  • Swagger Documentation: Automatically generated API documentation.
  • Logging & Monitoring: Detailed logging for monitoring and debugging.
  • Pagination: Efficient handling of large datasets.

🚀 Getting Started:

Prerequisites:

Configuration:

  1. Update the connection string in ProjectDbContext to match your SQL Server configuration:
    optionsBuilder
        .UseSqlServer("Server=your_server;Database=Project;User Id=your_user;Password=your_password;TrustServerCertificate=True")
        .LogTo(Console.WriteLine);

Usage:

  1. Build the project:
    dotnet build
  2. Run the project:
    dotnet run

📊 API Special Endpoints:

Product Endpoints:

  • Get All Products:

    • URL: /api/produs/get-products
    • Method: POST
    • Description: Endpoint to retrieve a list of all products.
    • Request Body: GetProduseRequest
    • Response: GetProduseResponse
  • Get Product by ID (Special):

    • URL: /api/produs/{produsId}/get-details
    • Method: GET
    • Description: Endpoint to retrieve details of a specific product.
    • Parameters: produsId (required)
    • Authorization: Requires role Admin.
    • Response: GetProdusResponse

Review Endpoints:

  • Get Reviews by Product ID:

    • URL: /api/review/produs/{produsId}/reviews
    • Method: GET
    • Description: Endpoint to retrieve reviews for a specific product.
    • Parameters: produsId (required)
    • Response: List of reviews
  • Add Review:

    • URL: /api/review/add
    • Method: POST
    • Description: Endpoint to add a new review.
    • Request Body: AddReviewRequest
    • Authorization: Requires role User.
    • Response: Success message
  • Update Review:

    • URL: /api/review/{reviewId}/edit-review
    • Method: PUT
    • Description: Endpoint to update an existing review.
    • Parameters: reviewId (required)
    • Request Body: UpdateReviewRequest
    • Authorization: Requires role User.
    • Response: Success message
  • Delete Review:

    • URL: /api/review/delete-review
    • Method: DELETE
    • Description: Endpoint to delete an existing review.
    • Parameters: reviewId (required)
    • Authorization: Requires role User.
    • Response: Success message

User Endpoints:

  • Register:

    • URL: /register
    • Method: POST
    • Description: Endpoint to register a new user.
    • Request Body: RegisterRequest
    • Authorization: Public (No authentication required).
    • Response: Success message
  • Login:

    • URL: /login
    • Method: POST
    • Description: Endpoint to authenticate a user and generate a JWT token.
    • Request Body: LoginRequest
    • Authorization: Public (No authentication required).
    • Response: JWT token

🛠️ Technologies Used:

  • .NET 6
  • Entity Framework Core
  • SQL Server
  • Swagger for API documentation
  • JWT Authentication

🤝 Contributing:

  1. Fork the repository
  2. Create a new branch (git checkout -b feature-branch)
  3. Make your changes
  4. Commit your changes (git commit -m 'Add some feature')
  5. Push to the branch (git push origin feature-branch)
  6. Open a Pull Request

✍️ by Teulea Ioan Octavian

About

This project is a Web API for managing a product catalog and user reviews, developed in C# using .NET Web API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages