Skip to content

Latest commit

Β 

History

257 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Š Pro-Sales β€” CRM Web API

Pro-Sales is a Customer Relationship Management (CRM) backend built with ASP.NET Core Web API and .NET 8.

The system is designed to help organizations manage customers, businesses, sales activities, deals, communication, users, and sales performance through a structured RESTful API.

The project focuses on building a realistic business-oriented backend while applying common architectural and software development patterns in ASP.NET Core.


🎯 Overview

Pro-Sales provides a centralized platform for managing customer relationships and sales activities.

The system supports different roles within the organization, allowing users such as managers, moderators, and sales representatives to perform operations according to their responsibilities.

The main business areas include:

  • Customer management
  • Business management
  • Sales and deal management
  • Calls
  • Meetings
  • Messages
  • Interests
  • Lead/source tracking
  • User profiles
  • Authentication
  • Role-based authorization
  • Sales reporting
  • Filtering and searching
  • Email communication

✨ Features

πŸ‘₯ Customer & Business Management

The system provides functionality for managing customers and businesses and maintaining the relationships between them.

Core models include:

  • Customers
  • Businesses
  • Interests
  • Sources

πŸ’Ό Sales & Deal Management

Sales representatives can manage sales activities and deals throughout the customer relationship process.

The system includes:

  • Deal management
  • Sales activities
  • Sales representatives
  • Customer interactions
  • Sales tracking

πŸ“ž Customer Communication

The CRM provides several mechanisms for recording and managing customer communication:

  • Calls
  • Meetings
  • Messages

These activities allow sales teams to keep track of their interactions with customers and prospects.


πŸ” Authentication & Authorization

The API includes authentication and role-based access control.

Different roles are represented within the application, including:

  • Manager
  • Moderator
  • Sales Representative
  • User

The API contains dedicated controllers and services for authentication, profiles, and role-specific operations.


πŸ“ˆ Reporting

The project contains a dedicated reporting area for generating business and sales-related statistics.

Current report models include:

  • Daily reports
  • Global statistics
  • Sales representative reports

This provides a foundation for analyzing sales activity and performance.


πŸ”Ž Filtering

The project includes filtering functionality for retrieving data based on different criteria.

Filtering is implemented as a reusable service rather than embedding all filtering logic directly into controllers.


πŸ“§ Email Communication

The application contains a mailing service responsible for handling email-related operations.

This can be used for communication and account-related workflows.


πŸ—οΈ Architecture

The solution is separated into three main projects:

Pro-Sales/
β”‚
β”œβ”€β”€ CRM/
β”‚   β”œβ”€β”€ Controllers/
β”‚   β”œβ”€β”€ Extensions/
β”‚   β”œβ”€β”€ Properties/
β”‚   β”œβ”€β”€ Program.cs
β”‚   └── appsettings.json
β”‚
β”œβ”€β”€ CRM.Core/
β”‚   β”œβ”€β”€ Consts/
β”‚   β”œβ”€β”€ Custom Attributes/
β”‚   β”œβ”€β”€ Dtos/
β”‚   β”œβ”€β”€ Filters/
β”‚   β”œβ”€β”€ Helpers/
β”‚   β”œβ”€β”€ Interfaces/
β”‚   β”œβ”€β”€ Models/
β”‚   β”œβ”€β”€ Reports/
β”‚   β”œβ”€β”€ Services/
β”‚   β”œβ”€β”€ Settings/
β”‚   └── IUnitOfWork.cs
β”‚
└── CRM.Infrastructure/
    β”œβ”€β”€ Data/
    β”œβ”€β”€ Migrations/
    β”œβ”€β”€ Repositories/
    └── UnitOfWork.cs

The repository's current structure confirms this separation between the API layer, core/application logic, and infrastructure/data-access concerns.


🧩 Core Layer

CRM.Core contains the application's central models, DTOs, abstractions, services, reports, helpers, and other reusable components.

Domain Models

The current model layer includes:

  • ApplicationUser
  • Business
  • Call
  • Customer
  • Deal
  • Interest
  • Meeting
  • Message
  • Source
  • VerificationCode
  • Authentication-related models

DTOs

The project uses DTOs to separate API contracts from internal models.

Examples include DTOs for:

  • Customers
  • Calls
  • Actions
  • Authentication
  • Other CRM operations

βš™οΈ Services

Business/application operations are organized into dedicated services.

Current service implementations include:

  • Authentication service
  • Filter service
  • Mailing service
  • Manager service
  • Moderator service
  • Reporting service
  • Sales service
  • Shared service
  • User profile service

This keeps controllers focused primarily on HTTP/API responsibilities while moving application operations into dedicated services.


πŸ—„οΈ Data Access

The infrastructure layer contains the application's persistence implementation.

It includes:

  • Entity Framework Core
  • ApplicationDbContext
  • Repository implementations
  • Unit of Work
  • Database migrations

The project also defines repository abstractions in the Core layer, keeping the application code separated from concrete data-access implementations.


🌐 API Layer

The CRM project contains the ASP.NET Core Web API entry point and controllers.

Current controllers include:

  • AuthController
  • ManagerController
  • ModeratorController
  • ReportsController
  • SalesRepController
  • SharedController
  • UserProfileController

The API layer is responsible for exposing the CRM functionality through HTTP endpoints.


πŸ“Š Reporting

Reporting is separated into its own area within the Core project.

Current report types include:

DailyReport
GlobalStat
SalesRepresentativeReport

These reports provide information that can be used to understand sales activity and overall business performance.


πŸ› οΈ Technology Stack

Technology Purpose
C# Programming language
.NET 8 Runtime and platform
ASP.NET Core Web API REST API
Entity Framework Core ORM / data access
SQL Server Relational database
JWT / Authentication User authentication
ASP.NET Core Authorization Role-based access
Repository Pattern Data-access abstraction
Unit of Work Transaction coordination
DTOs API/application data transfer
Swagger / OpenAPI API exploration and documentation

πŸ“ Project Structure

CRM

The API/presentation layer.

CRM/
β”œβ”€β”€ Controllers/
β”œβ”€β”€ Extensions/
β”œβ”€β”€ Properties/
β”œβ”€β”€ Program.cs
└── appsettings.json

CRM.Core

The application's core layer.

CRM.Core/
β”œβ”€β”€ Consts/
β”œβ”€β”€ Custom Attributes/
β”œβ”€β”€ Dtos/
β”œβ”€β”€ Filters/
β”œβ”€β”€ Helpers/
β”œβ”€β”€ Interfaces/
β”œβ”€β”€ Models/
β”œβ”€β”€ Reports/
β”œβ”€β”€ Services/
└── Settings/

CRM.Infrastructure

The infrastructure and persistence layer.

CRM.Infrastructure/
β”œβ”€β”€ Data/
β”œβ”€β”€ Migrations/
β”œβ”€β”€ Repositories/
└── UnitOfWork.cs

πŸš€ Getting Started

Prerequisites

Make sure you have installed:

  • .NET 8 SDK
  • SQL Server
  • Git

Clone the Repository

git clone https://github.com/Mahmoud-Mshrf/Pro-Sales.git

Navigate into the project:

cd Pro-Sales

Restore the dependencies:

dotnet restore

Build the solution:

dotnet build

Database

Configure the SQL Server connection string in:

CRM/appsettings.json

Then apply the Entity Framework Core migrations:

dotnet ef database update

Run the API

dotnet run --project CRM

Once the application starts, use the configured API/Swagger endpoint to explore the available endpoints.


πŸ”‘ Authentication Flow

The API includes authentication functionality through the dedicated authentication controller and service.

A typical flow is:

Client
   β”‚
   β–Ό
Authentication
   β”‚
   β–Ό
JWT / Identity
   β”‚
   β–Ό
Authenticated Request
   β”‚
   β–Ό
Role-Based Authorization
   β”‚
   β–Ό
CRM Endpoint

Different parts of the CRM can then be protected according to the user's role and responsibilities.


🧠 Design Patterns & Practices

The project demonstrates several backend development concepts and patterns:

Repository Pattern

Provides an abstraction over data-access operations.

Unit of Work

Coordinates multiple repository operations and database persistence.

Dependency Injection

Services and infrastructure components are registered and resolved through ASP.NET Core's dependency injection system.

DTO Pattern

DTOs are used to define explicit data contracts between the API and the application.

Service Layer

Application operations are organized into dedicated services instead of placing all business logic inside controllers.

Role-Based Authorization

Different users can access functionality according to their assigned roles.


πŸ“Œ Project Purpose

Pro-Sales was developed as a practical backend project to apply ASP.NET Core concepts in a realistic CRM/business domain.

Rather than implementing only simple CRUD operations, the project explores how different backend components work together:

HTTP Request
     β”‚
     β–Ό
Controller
     β”‚
     β–Ό
Service
     β”‚
     β–Ό
Repository / Unit of Work
     β”‚
     β–Ό
Entity Framework Core
     β”‚
     β–Ό
SQL Server

This structure helps separate responsibilities and makes the application easier to understand and maintain.


πŸ“š What This Project Demonstrates

Through this project, the following areas are practiced:

  • ASP.NET Core Web API
  • RESTful API development
  • Dependency Injection
  • Authentication
  • Authorization
  • Role-based access control
  • Entity Framework Core
  • SQL Server
  • Repository Pattern
  • Unit of Work Pattern
  • DTOs
  • Service Layer
  • Database migrations
  • Customer relationship management
  • Sales management
  • Business logic
  • Filtering
  • Reporting
  • Email communication
  • API design

πŸ‘¨β€πŸ’» Author

Mahmoud Mshrf

.NET Backend Developer focused on C#, ASP.NET Core, Web APIs, and backend architecture.

GitHub: https://github.com/Mahmoud-Mshrf


⭐ About the Project

Pro-Sales is a backend-focused CRM project built to explore how a real business application can be structured using ASP.NET Core and common backend architectural patterns.

The project is continuously evolving as new concepts are learned and existing implementations are improved.

Built with C# and ASP.NET Core.

About

ASP.NET Core Web API CRM built with .NET 8, featuring customer and business management, sales and deal tracking, calls, meetings, messaging, authentication, role-based access, filtering, reporting, email communication, EF Core, Repository and Unit of Work patterns.

Resources

Stars

2 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages