Initial commit — AsadiTools v1.0
Full ASP.NET Core 10 Razor Pages app for آساد ابزار tool repair shop in Karaj, Iran (official DeWalt representative). Features: - Homepage, Services, DeWalt page, Shop (pagination + images) - 10 brand SEO pages (/brands/*) with rich Persian content + FAQ schema - Blog engine with admin management (/blog, /Admin/Blog) - Cart, Checkout, Contact (OpenStreetMap embed) - Admin panel: Products CRUD, Orders, Blog, Change Password - Jalali date formatting, product images, SiteData centralised contact - Docker + docker-compose with healthcheck - Gitea CI/CD via .gitea/workflows/ci-cd.yml (NuGet through Nexus mirror) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
namespace AsadiTools.Models;
|
||||
|
||||
public class AdminUser
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Username { get; set; } = string.Empty;
|
||||
public string PasswordHash { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
namespace AsadiTools.Models;
|
||||
|
||||
public class BlogPost
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Slug { get; set; } = string.Empty;
|
||||
public string Content { get; set; } = string.Empty; // raw HTML
|
||||
public string? Excerpt { get; set; }
|
||||
public string? MetaDescription { get; set; }
|
||||
public string? FeaturedImage { get; set; }
|
||||
public string? Tags { get; set; } // comma-separated
|
||||
public bool IsPublished { get; set; } = false;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.Now;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.Now;
|
||||
public DateTime? PublishedAt { get; set; }
|
||||
|
||||
// Helpers
|
||||
public string[] TagList =>
|
||||
Tags?.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries) ?? [];
|
||||
|
||||
public string EffectiveSlug =>
|
||||
!string.IsNullOrWhiteSpace(Slug) ? Slug : $"post-{Id}";
|
||||
|
||||
public string DisplayDate =>
|
||||
(PublishedAt ?? CreatedAt) is var dt
|
||||
? AsadiTools.Services.SiteData.ToJalali(dt)
|
||||
: string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace AsadiTools.Models;
|
||||
|
||||
public class CartItem
|
||||
{
|
||||
public int ProductId { get; set; }
|
||||
public string NameFa { get; set; } = string.Empty;
|
||||
public string? Sku { get; set; }
|
||||
public decimal Price { get; set; }
|
||||
public int Qty { get; set; }
|
||||
public decimal Subtotal => Price * Qty;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
namespace AsadiTools.Models;
|
||||
|
||||
public enum OrderStatus
|
||||
{
|
||||
Pending,
|
||||
Confirmed,
|
||||
Shipped,
|
||||
Delivered,
|
||||
Cancelled
|
||||
}
|
||||
|
||||
public class Order
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string OrderNumber { get; set; } = string.Empty;
|
||||
public string CustomerName { get; set; } = string.Empty;
|
||||
public string CustomerPhone { get; set; } = string.Empty;
|
||||
public string? CustomerAddress { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
public decimal Subtotal { get; set; }
|
||||
public decimal Total { get; set; }
|
||||
public OrderStatus Status { get; set; } = OrderStatus.Pending;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.Now;
|
||||
public List<OrderItem> Items { get; set; } = [];
|
||||
}
|
||||
|
||||
public class OrderItem
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int OrderId { get; set; }
|
||||
public Order Order { get; set; } = null!;
|
||||
public int ProductId { get; set; }
|
||||
public string ProductNameFa { get; set; } = string.Empty;
|
||||
public decimal Price { get; set; }
|
||||
public int Quantity { get; set; }
|
||||
public decimal Subtotal => Price * Quantity;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace AsadiTools.Models;
|
||||
|
||||
public class Product
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string NameFa { get; set; } = string.Empty;
|
||||
public string? NameEn { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public decimal Price { get; set; }
|
||||
public decimal? DiscountPrice { get; set; }
|
||||
public string Category { get; set; } = string.Empty;
|
||||
public string? Brand { get; set; }
|
||||
public string? Sku { get; set; }
|
||||
public int Stock { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
public string? ImageUrl { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.Now;
|
||||
|
||||
public decimal FinalPrice => DiscountPrice.HasValue && DiscountPrice < Price ? DiscountPrice.Value : Price;
|
||||
public bool HasDiscount => DiscountPrice.HasValue && DiscountPrice < Price;
|
||||
}
|
||||
Reference in New Issue
Block a user