Skip to content
/ is.NET Public

🎨 LunaSpaceX β€” Multi-location inventory & stock management with real-time tracking and secure authentication.

Notifications You must be signed in to change notification settings

AlphsX/is.NET

Repository files navigation

LunaSpaceX ✨

.NET 6.0 ASP.NET Core C# 10 SQL Server License

A modern, enterprise-grade inventory and stock management system built with ASP.NET Core Razor Pages. LunaSpaceX provides multi-location store support with comprehensive CRUD operations, user authentication, and real-time inventory tracking.


πŸš€ Features

Core Capabilities

  • Multi-Location Store Management: Support for multiple physical locations (Rangsit, Siam, etc.)
  • Inventory Tracking: Real-time stock monitoring and management
  • User Authentication: Integrated ASP.NET Core Identity with secure account management
  • Responsive UI: Bootstrap-based responsive design for desktop and mobile
  • Database-First Architecture: Entity Framework Core with SQL Server integration
  • RESTful CRUD Operations: Create, Read, Update, Delete operations for all entities

Technical Highlights

  • βœ… Built on .NET 6.0 LTS framework
  • βœ… Razor Pages for clean, maintainable server-side rendering
  • βœ… Entity Framework Core with SQL Server provider
  • βœ… ASP.NET Core Identity for authentication & authorization
  • βœ… Bootstrap 4/5 for responsive styling
  • βœ… jQuery Validation for client-side form validation
  • βœ… Scoped CSS for component-level styling

πŸ“‹ Table of Contents

πŸ“¦ Prerequisites

Before you begin, ensure you have the following installed:

  • .NET SDK 6.0 or higher (Download)
  • SQL Server 2019 or later (or Azure SQL Database)
  • Visual Studio 2022 / VS Code with C# extension
  • Git for version control

System Requirements

  • OS: Windows 10/11, macOS, or Linux
  • RAM: 4GB minimum (8GB recommended)
  • Disk Space: 500MB+ for development environment

πŸ”§ Installation

1. Clone the Repository

git clone https://github.com/yourusername/LunaSpaceX.git
cd LunaSpaceX

2. Restore NuGet Packages

dotnet restore

3. Configure Database Connection

Edit appsettings.json or appsettings.Development.json:

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=YOUR_SERVER;Database=YOUR_DATABASE;Trusted_Connection=True;MultipleActiveResultSets=true"
  }
}

For Azure SQL Database:

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=tcp:your-server.database.windows.net,1433;Initial Catalog=your-database;Persist Security Info=False;User ID=your-username;Password=your-password;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
  }
}

4. Apply Database Migrations

dotnet ef database update

5. Build the Solution

dotnet build

πŸ“ Project Structure

LunaSpaceX/
β”œβ”€β”€ Pages/                           # Razor Pages views and logic
β”‚   β”œβ”€β”€ Shared/                      # Shared layouts and partials
β”‚   β”‚   β”œβ”€β”€ _Layout.cshtml           # Master layout template
β”‚   β”‚   β”œβ”€β”€ _Layout.cshtml.css       # Scoped layout styles
β”‚   β”‚   └── _LoginPartial.cshtml     # Authentication UI partial
β”‚   β”œβ”€β”€ Rangsit/                     # Rangsit store inventory pages
β”‚   β”‚   β”œβ”€β”€ IndexRangsit.cshtml(.cs) # Stock listing
β”‚   β”‚   β”œβ”€β”€ CreateRangsit.cshtml(.cs)# New stock form
β”‚   β”‚   β”œβ”€β”€ EditRangsit.cshtml(.cs)  # Edit stock form
β”‚   β”‚   └── DeleteRangsit.cshtml     # Delete confirmation
β”‚   β”œβ”€β”€ Siam/                        # Siam store inventory pages
β”‚   β”‚   β”œβ”€β”€ IndexSiam.cshtml(.cs)    # Stock listing
β”‚   β”‚   β”œβ”€β”€ CreateSiam.cshtml(.cs)   # New stock form
β”‚   β”‚   β”œβ”€β”€ EditSiam.cshtml(.cs)     # Edit stock form
β”‚   β”‚   └── DeleteSiam.cshtml        # Delete confirmation
β”‚   β”œβ”€β”€ Index.cshtml(.cs)            # Homepage
β”‚   β”œβ”€β”€ Privacy.cshtml(.cs)          # Privacy policy
β”‚   └── Error.cshtml(.cs)            # Error page
β”œβ”€β”€ Data/                            # Data access layer
β”‚   β”œβ”€β”€ ApplicationDbContext.cs      # EF Core DbContext
β”‚   └── Migrations/                  # Database migration scripts
β”œβ”€β”€ Areas/                           # Feature areas
β”‚   └── Identity/                    # ASP.NET Core Identity pages
β”œβ”€β”€ Properties/
β”‚   β”œβ”€β”€ launchSettings.json          # Launch profile configuration
β”‚   β”œβ”€β”€ serviceDependencies.json     # Service dependencies
β”‚   └── serviceDependencies.local.json
β”œβ”€β”€ wwwroot/                         # Static assets
β”‚   β”œβ”€β”€ css/                         # Stylesheets
β”‚   β”‚   └── site.css                 # Global styles
β”‚   β”œβ”€β”€ js/                          # JavaScript files
β”‚   β”‚   └── site.js                  # Global scripts
β”‚   β”œβ”€β”€ libs/                        # Third-party libraries
β”‚   β”‚   β”œβ”€β”€ bootstrap/               # Bootstrap framework
β”‚   β”‚   β”œβ”€β”€ jquery/                  # jQuery library
β”‚   β”‚   └── jquery-validation/       # Client-side validation
β”‚   └── imgs/                        # Images and assets
β”œβ”€β”€ Program.cs                       # Application entry point & configuration
β”œβ”€β”€ LunaSpaceX.csproj               # Project file (.NET configuration)
β”œβ”€β”€ LunaSpaceX.sln                  # Solution file
β”œβ”€β”€ appsettings.json                # Production configuration
β”œβ”€β”€ appsettings.Development.json    # Development configuration
└── README.md                        # This file

βš™οΈ Configuration

Application Settings

appsettings.json (Production):

{
  "ConnectionStrings": {
    "DefaultConnection": "Production connection string here"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*"
}

appsettings.Development.json (Development):

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-LunaSpaceX-dev;Trusted_Connection=True;"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Debug",
      "Microsoft.AspNetCore": "Debug"
    }
  }
}

Authentication Configuration

The application uses ASP.NET Core Identity with the following configuration in Program.cs:

builder.Services.AddDefaultIdentity<IdentityUser>(options => 
    options.SignIn.RequireConfirmedAccount = true)
    .AddEntityFrameworkStores<ApplicationDbContext>();

Key Settings:

  • Email confirmation required for new accounts
  • Password complexity enforced by Identity defaults
  • Session timeout configurable per deployment

πŸš€ Running the Application

Development Mode

dotnet run --configuration Development

The application will be available at:

  • HTTP: http://localhost:5000
  • HTTPS: https://localhost:5001

Production Mode

dotnet run --configuration Release

Using Visual Studio

  1. Set LunaSpaceX as the startup project
  2. Select your desired configuration (Debug/Release)
  3. Press F5 to run with debugging, or Ctrl+F5 without debugging

Docker Deployment (Optional)

Create a Dockerfile:

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime
WORKDIR /app
COPY bin/Release/net6.0/publish .
EXPOSE 80 443
ENTRYPOINT ["dotnet", "LunaSpaceX.dll"]

Build and run:

docker build -t lunaspacex:latest .
docker run -p 80:80 -p 443:443 lunaspacex:latest

πŸ—οΈ Architecture

Design Patterns

  • Razor Pages Pattern: Page-per-feature organization with code-behind models
  • Repository-like Pattern: Direct database queries via EF Core DbContext
  • Dependency Injection: Built-in .NET DI container for service registration
  • Identity-based Authorization: Claims-based access control

Layering

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Presentation Layer (Razor Pages)  β”‚
β”‚   - Views (.cshtml)                 β”‚
β”‚   - Page Models (.cshtml.cs)        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Application Layer                 β”‚
β”‚   - Page Handlers (OnGet, OnPost)   β”‚
β”‚   - Business Logic                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Data Access Layer (EF Core)       β”‚
β”‚   - ApplicationDbContext            β”‚
β”‚   - DbSet<T> entities               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Data Storage (SQL Server)         β”‚
β”‚   - Stocks table                    β”‚
β”‚   - Identity tables                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ—„οΈ Database

Entity Schema

The application uses the following primary entities:

Stocks Table:

CREATE TABLE stocks (
    itemid INT PRIMARY KEY IDENTITY(1,1),
    item NVARCHAR(MAX),
    storeid INT,
    supplier NVARCHAR(MAX),
    [...]
);

Store Locations:

  • storeid = 1: Rangsit
  • storeid = 2: Siam

Migrations

View all applied migrations:

dotnet ef migrations list

Create a new migration:

dotnet ef migrations add YourMigrationName

Apply pending migrations:

dotnet ef database update

Rollback last migration:

dotnet ef database update PreviousMigrationName

πŸ”Œ API Endpoints

Stock Management

Method Endpoint Description
GET /Rangsit List all Rangsit stocks
GET /Siam List all Siam stocks
GET /Rangsit/Create Show create form (Rangsit)
POST /Rangsit/Create Create new stock (Rangsit)
GET /Rangsit/Edit/{id} Show edit form (Rangsit)
POST /Rangsit/Edit/{id} Update stock (Rangsit)
GET /Rangsit/Delete/{id} Show delete confirmation
POST /Rangsit/Delete/{id} Delete stock

Similar endpoints exist for /Siam/*

Authentication

Method Endpoint Description
GET /Identity/Account/Login Login page
POST /Identity/Account/Login Submit login
GET /Identity/Account/Register Registration page
POST /Identity/Account/Register Create account
POST /Identity/Account/Logout Logout user

General

Method Endpoint Description
GET / Homepage
GET /Privacy Privacy policy
GET /Error Error page

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

Code Style & Conventions

  • C# Naming: PascalCase for public members, camelCase for local variables
  • File Organization: One class per file
  • Indentation: 4 spaces
  • Async/Await: Use async patterns for I/O operations

Building from Source

# Clean previous builds
dotnet clean

# Restore dependencies
dotnet restore

# Build the solution
dotnet build

# Run tests (if any)
dotnet test

# Package for release
dotnet publish -c Release -o ./publish

Debugging

Visual Studio:

  • Set breakpoints (F9)
  • Run with debugging (F5)
  • Step through code (F10/F11)

VS Code:

  • Install C# extension
  • Create .vscode/launch.json
  • Press F5 to start debugging

Useful Commands

# Check for .NET CLI tools
dotnet tool list -g

# Update .NET CLI tools
dotnet tool update -g dotnet-ef

# Analyze project structure
dotnet sln list

# View project dependencies
dotnet list reference

🀝 Contributing

We welcome contributions from the community! Here's how to get started:

Before You Begin

  1. Fork the repository
  2. Clone your fork locally
  3. Create a new feature branch: git checkout -b feature/your-feature-name

Development Workflow

# Create feature branch
git checkout -b feature/amazing-feature

# Make your changes
# Write clean, well-documented code
# Test thoroughly

# Commit with clear messages
git commit -m "feat: add amazing feature"

# Push to your fork
git push origin feature/amazing-feature

# Create a Pull Request on GitHub

Commit Message Conventions

Follow Conventional Commits:

feat: add new inventory filter
fix: resolve stock update bug
docs: update database schema docs
refactor: simplify database query logic
test: add tests for stock CRUD operations

Code Review Process

  1. Ensure all tests pass
  2. Follow project code style
  3. Add/update documentation as needed
  4. Respond to review feedback
  5. Merge after approval

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

MIT License permits:

  • βœ… Commercial use
  • βœ… Modification
  • βœ… Distribution
  • βœ… Private use

With the conditions:

  • πŸ“‹ License and copyright notice must be included

πŸ“ž Support & Contact

πŸ—ΊοΈ Roadmap

Planned Features (v2.0)

  • Advanced filtering and search
  • Export to Excel/CSV
  • Mobile app (React Native)
  • Real-time notifications
  • Audit logging
  • API endpoint documentation (Swagger/OpenAPI)
  • Unit and integration tests
  • Docker containerization

Performance Improvements

  • Query optimization
  • Caching layer (Redis)
  • Pagination for large datasets
  • Async/await patterns throughout

πŸ“š Additional Resources


Built with ❀️ using ASP.NET Core & SQL Server

⭐ If you find this project helpful, please consider giving it a star!

About

🎨 LunaSpaceX β€” Multi-location inventory & stock management with real-time tracking and secure authentication.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published