This project is a foundational Contact Management System (CRM) built as an ASP.NET Core MVC web application. It provides a centralized platform for a business to manage its customers, track interactions, and monitor sales opportunities. The system is designed with a "Code-First" approach using Entity Framework Core, making it easy to understand, maintain, and extend. The primary goal is to create a robust and scalable starting point for a full-featured internal business application.
The application successfully implements all the requested core functionalities of a modern CRM:
-
Centralized Customer Database:
- Accounts: Manages core customer entities (companies or organizations).
- Contacts: Manages individual people associated with each Account. The relationship is clearly defined (one Account can have many Contacts).
-
Interaction History:
- A comprehensive log of all touchpoints with a customer.
- Supports various interaction types (Email, Call, Meeting, Note) through an enum for easy extension.
- Interactions are linked to specific Contacts, and all interactions for an Account are viewable on a single page.
-
Lead and Opportunity Tracking:
- Leads: Captures and tracks potential new customers who are not yet qualified.
- Opportunities: Tracks potential sales deals with existing Accounts, complete with a monetary value, sales stage, and estimated close date.
-
Customer Segmentation:
- Allows for the dynamic creation of customer segments (e.g., "High-Value," "Tech Industry," "Churn Risk").
- Implements a flexible many-to-many relationship, enabling a single Account to belong to multiple segments simultaneously.
The project is built on a modern, standard Microsoft technology stack, emphasizing best practices for web development.
- Framework: ASP.NET Core 8.0 MVC
- Utilizes the Model-View-Controller (MVC) design pattern, which promotes a clean separation of concerns:
- Models: Define the data structure and business logic (the "what").
- Views: Handle the user interface and presentation (the "how it looks").
- Controllers: Act as the intermediary, processing user input and managing application flow (the "how it works").
- Utilizes the Model-View-Controller (MVC) design pattern, which promotes a clean separation of concerns:
- Language: C#
- Database: SQL Server (via LocalDB)
- A robust, production-ready relational database system.
- Data Access Layer: Entity Framework Core (EF Core)
- An Object-Relational Mapper (ORM) that simplifies database interactions.
- Code-First Approach: The database schema is generated directly from the C# model classes, making the code the single source of truth for the data structure.
- Migrations: Used to version-control the database schema, allowing for safe and repeatable updates.
- Frontend: Razor Views with Bootstrap 5
- Razor provides a powerful syntax for embedding C# code within HTML to generate dynamic web pages.
- Bootstrap ensures a responsive, mobile-first design out-of-the-box.
- Dependency Injection (DI):
- ASP.NET Core's built-in DI container is used to manage dependencies, such as injecting the
ApplicationDbContextinto controllers. This makes the application more modular and testable.
- ASP.NET Core's built-in DI container is used to manage dependencies, such as injecting the
- Relational Data: The power of the system comes from the well-defined relationships between models (
Account->Contacts,Account->Opportunities, etc.). EF Core manages these foreign key relationships automatically. - Centralized View (
Account/Details): The Account Details page serves as the central hub. It uses EF Core's.Include()and.ThenInclude()methods to eagerly load and display all related data (contacts, opportunities, interactions, and segments) in a single, consolidated view. - Many-to-Many Relationship (
Account<>Segment): This was implemented using a dedicated join entity (AccountSegment). TheAccountsControllercontains custom logic in itsEditaction to process the list of selected segments from the view, compare it to the existing data, and correctly add or remove records from the join table. - Data Seeding: The
DbInitializerclass provides a clean way to populate the database with realistic sample data on the first run, making the application immediately testable and demonstrable.
- Open the
ContactManager.slnfile in Visual Studio 2022. - Ensure the connection string in
appsettings.jsonis correctly configured for your SQL Server instance (the default points to LocalDB). - Open the Package Manager Console.
- Run the command
Update-Databaseto create the database and its tables from the migration files. - Press F5 or the green start button to build and run the application. The browser will open, and the application will be ready to use.
This project serves as an excellent foundation. Future enhancements could include:
- Authentication & Authorization: Use ASP.NET Core Identity to add user logins and role-based security (e.g., Sales, Manager, Admin roles).
- Dashboard: Create a home page dashboard with summary statistics and charts (e.g., sales pipeline, recent activities).
- Advanced Filtering & Searching: Implement search functionality on the index pages.
- API Endpoints: Expose the data via a RESTful API to allow for integration with other systems or a JavaScript-based front-end framework (like React or Angular).
- Unit & Integration Testing: Add test projects to ensure code quality and prevent regressions.