Bu plan, mevcut DapperCleanSample API'si için bir web UI implementasyonu içerir. API zaten hazýr ve çalýþýr durumda.
| Seçenek | Framework | Açýklama |
|---|---|---|
| A | Blazor WebAssembly | .NET ekosisteminde kalýr, C# ile UI |
| B | Blazor Server | Daha hýzlý baþlangýç, server-side rendering |
| C | React + TypeScript | Modern, geniþ ekosistem |
| D | Vue.js | Öðrenmesi kolay, hafif |
Önerilen: Blazor WebAssembly (Proje .NET 10, tutarlýlýk için)
https://localhost:7142
| Method | Endpoint | Request Body | Response |
|---|---|---|---|
| GET | /api/customers |
- | CustomerDto[] |
| GET | /api/customers/paged?pageNumber=1&pageSize=10 |
- | PagedResult<CustomerDto> |
| GET | /api/customers/{id} |
- | CustomerDto |
| GET | /api/customers/email/{email} |
- | CustomerDto |
| POST | /api/customers |
CreateCustomerRequest |
{ id: int } |
| PUT | /api/customers/{id} |
UpdateCustomerRequest |
204 No Content |
| DELETE | /api/customers/{id} |
- | 204 No Content |
| Method | Endpoint | Request Body | Response |
|---|---|---|---|
| GET | /api/products |
- | ProductDto[] |
| GET | /api/products/paged?pageNumber=1&pageSize=10 |
- | PagedResult<ProductDto> |
| GET | /api/products/{id} |
- | ProductDto |
| POST | /api/products |
CreateProductRequest |
{ id: int } |
| PUT | /api/products/{id} |
UpdateProductRequest |
204 No Content |
| DELETE | /api/products/{id} |
- | 204 No Content |
| Method | Endpoint | Request Body | Response |
|---|---|---|---|
| GET | /api/orders/paged?pageNumber=1&pageSize=10 |
- | PagedResult<OrderDto> |
| GET | /api/orders/{id} |
- | OrderDto |
| GET | /api/orders/{id}/details |
- | OrderDto (with items) |
| GET | /api/orders/customer/{customerId} |
- | OrderDto[] |
| POST | /api/orders |
CreateOrderRequest |
{ id: int } |
| PATCH | /api/orders/{id}/pay |
- | 204 No Content |
| PATCH | /api/orders/{id}/ship |
- | 204 No Content |
| PATCH | /api/orders/{id}/deliver |
- | 204 No Content |
| PATCH | /api/orders/{id}/cancel |
- | 204 No Content |
| DELETE | /api/orders/{id} |
- | 204 No Content |
// Customer
interface CustomerDto {
id: number;
name: string;
email: string;
createdAt: string;
}
interface CreateCustomerRequest {
name: string;
email: string;
}
interface UpdateCustomerRequest {
name: string;
email: string;
}
// Product
interface ProductDto {
id: number;
name: string;
price: number;
createdAt: string;
}
interface CreateProductRequest {
name: string;
price: number;
}
interface UpdateProductRequest {
name: string;
price: number;
}
// Order
interface OrderDto {
id: number;
customerId: number;
orderDate: string;
status: OrderStatus;
createdAt: string;
items?: OrderItemDto[];
}
interface OrderItemDto {
id: number;
orderId: number;
productId: number;
quantity: number;
unitPrice: number;
totalPrice: number;
}
interface CreateOrderRequest {
customerId: number;
items: CreateOrderItemRequest[];
}
interface CreateOrderItemRequest {
productId: number;
quantity: number;
unitPrice: number;
}
// Enums
enum OrderStatus {
Pending = 0,
Paid = 1,
Shipped = 2,
Delivered = 3,
Cancelled = 4
}
// Pagination
interface PagedResult<T> {
items: T[];
pageNumber: number;
pageSize: number;
totalCount: number;
totalPages: number;
}???????????????????????????????????????????????????????????????
? DASHBOARD ?
???????????????????????????????????????????????????????????????
? ??????????????? ??????????????? ??????????????? ?
? ? Customers ? ? Products ? ? Orders ? ?
? ? 12 ? ? 45 ? ? 28 ? ?
? ??????????????? ??????????????? ??????????????? ?
? ?
? Son Sipariþler ?
? ??????????????????????????????????????????????????????? ?
? ? # ? Customer ? Date ? Status ? Total ? ?
? ? 1 ? John Doe ? 2024-01-15 ? Pending ? $150 ? ?
? ? 2 ? Jane Smith ? 2024-01-14 ? Shipped ? $280 ? ?
? ??????????????????????????????????????????????????????? ?
???????????????????????????????????????????????????????????????
???????????????????????????????????????????????????????????????
? CUSTOMERS [+ New Customer] ?
???????????????????????????????????????????????????????????????
? Search: [________________] [Search] ?
? ?
? ??????????????????????????????????????????????????????? ?
? ? ID ? Name ? Email ? Actions ? ?
? ? 1 ? John Doe ? john@example.com ? [Edit][Del] ? ?
? ? 2 ? Jane Smith ? jane@example.com ? [Edit][Del] ? ?
? ? 3 ? Bob Wilson ? bob@example.com ? [Edit][Del] ? ?
? ??????????????????????????????????????????????????????? ?
? ?
? [< Prev] Page 1 of 5 [Next >] ?
???????????????????????????????????????????????????????????????
Modal: Create/Edit Customer
???????????????????????????????????
? New Customer [X] ?
???????????????????????????????????
? Name: [________________] ?
? Email: [________________] ?
? ?
? [Cancel] [Save] ?
???????????????????????????????????
???????????????????????????????????????????????????????????????
? PRODUCTS [+ New Product] ?
???????????????????????????????????????????????????????????????
? ??????????????????????????????????????????????????????? ?
? ? ID ? Name ? Price ? Created ?Actions ? ?
? ? 1 ? Laptop ? $15,000 ? 2024-01-10 ?[Ed][De]? ?
? ? 2 ? Mouse ? $250 ? 2024-01-11 ?[Ed][De]? ?
? ? 3 ? Keyboard ? $450 ? 2024-01-12 ?[Ed][De]? ?
? ??????????????????????????????????????????????????????? ?
? ?
? [< Prev] Page 1 of 3 [Next >] ?
???????????????????????????????????????????????????????????????
Modal: Create/Edit Product
???????????????????????????????????
? New Product [X] ?
???????????????????????????????????
? Name: [________________] ?
? Price: [________________] ?
? ?
? [Cancel] [Save] ?
???????????????????????????????????
???????????????????????????????????????????????????????????????
? ORDERS [+ New Order] ?
???????????????????????????????????????????????????????????????
? Filter: [All Statuses v] Customer: [All v] ?
? ?
? ??????????????????????????????????????????????????????? ?
? ? ID ? Customer ? Date ? Status ? Total ?Act. ? ?
? ? 1 ? John Doe ? 2024-01-15 ? Pending ? $150 ?[Vw] ? ?
? ? 2 ? Jane S. ? 2024-01-14 ? Paid ? $280 ?[Vw] ? ?
? ? 3 ? Bob W. ? 2024-01-13 ? Shipped ? $500 ?[Vw] ? ?
? ??????????????????????????????????????????????????????? ?
? ?
? [< Prev] Page 1 of 10 [Next >] ?
???????????????????????????????????????????????????????????????
???????????????????????????????????????????????????????????????
? ORDER #1 [Back] ?
???????????????????????????????????????????????????????????????
? Customer: John Doe ?
? Date: 2024-01-15 ?
? Status: [Pending] -> [Pay] [Cancel] ?
? ?
? Items: ?
? ??????????????????????????????????????????????????????? ?
? ? Product ? Quantity ? Unit Price ? Total ? ?
? ? Laptop ? 1 ? $15,000 ? $15,000 ? ?
? ? Mouse ? 2 ? $250 ? $500 ? ?
? ??????????????????????????????????????????????????????? ?
? ?
? Total: $15,500 ?
? ?
? Status Actions: ?
? [Pending] --[Pay]--> [Paid] --[Ship]--> [Shipped] ?
? | | --[Deliver]--> [Done] ?
? +--[Cancel]--------+ ?
???????????????????????????????????????????????????????????????
???????????????????????????????????????????????????????????????
? NEW ORDER ?
???????????????????????????????????????????????????????????????
? Customer: [Select Customer v] ?
? ?
? Items: ?
? ??????????????????????????????????????????????????????? ?
? ? Product [Select v] ? Qty [__] ? Price [____] ? [X] ? ?
? ? Product [Select v] ? Qty [__] ? Price [____] ? [X] ? ?
? ??????????????????????????????????????????????????????? ?
? [+ Add Item] ?
? ?
? Total: $0.00 ?
? ?
? [Cancel] [Create Order] ?
???????????????????????????????????????????????????????????????
???????????????
? LOGO ?
???????????????
? Dashboard ? -> /
? Customers ? -> /customers
? Products ? -> /products
? Orders ? -> /orders
???????????????
// customerService.ts
const API_BASE = 'https://localhost:7142';
export const customerService = {
getAll: () => fetch(`${API_BASE}/api/customers`),
getPaged: (page: number, size: number) =>
fetch(`${API_BASE}/api/customers/paged?pageNumber=${page}&pageSize=${size}`),
getById: (id: number) => fetch(`${API_BASE}/api/customers/${id}`),
getByEmail: (email: string) => fetch(`${API_BASE}/api/customers/email/${email}`),
create: (data: CreateCustomerRequest) =>
fetch(`${API_BASE}/api/customers`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
}),
update: (id: number, data: UpdateCustomerRequest) =>
fetch(`${API_BASE}/api/customers/${id}`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
}),
delete: (id: number) =>
fetch(`${API_BASE}/api/customers/${id}`, { method: 'DELETE' }),
};
// productService.ts
export const productService = {
getAll: () => fetch(`${API_BASE}/api/products`),
getPaged: (page: number, size: number) =>
fetch(`${API_BASE}/api/products/paged?pageNumber=${page}&pageSize=${size}`),
getById: (id: number) => fetch(`${API_BASE}/api/products/${id}`),
create: (data: CreateProductRequest) =>
fetch(`${API_BASE}/api/products`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
}),
update: (id: number, data: UpdateProductRequest) =>
fetch(`${API_BASE}/api/products/${id}`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
}),
delete: (id: number) =>
fetch(`${API_BASE}/api/products/${id}`, { method: 'DELETE' }),
};
// orderService.ts
export const orderService = {
getPaged: (page: number, size: number) =>
fetch(`${API_BASE}/api/orders/paged?pageNumber=${page}&pageSize=${size}`),
getById: (id: number) => fetch(`${API_BASE}/api/orders/${id}`),
getWithItems: (id: number) => fetch(`${API_BASE}/api/orders/${id}/details`),
getByCustomer: (customerId: number) =>
fetch(`${API_BASE}/api/orders/customer/${customerId}`),
create: (data: CreateOrderRequest) =>
fetch(`${API_BASE}/api/orders`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
}),
markAsPaid: (id: number) =>
fetch(`${API_BASE}/api/orders/${id}/pay`, { method: 'PATCH' }),
ship: (id: number) =>
fetch(`${API_BASE}/api/orders/${id}/ship`, { method: 'PATCH' }),
deliver: (id: number) =>
fetch(`${API_BASE}/api/orders/${id}/deliver`, { method: 'PATCH' }),
cancel: (id: number) =>
fetch(`${API_BASE}/api/orders/${id}/cancel`, { method: 'PATCH' }),
delete: (id: number) =>
fetch(`${API_BASE}/api/orders/${id}`, { method: 'DELETE' }),
};| Component | Açýklama |
|---|---|
Layout |
Ana layout, sidebar, header |
DataTable |
Pagination destekli tablo |
Modal |
Create/Edit modal |
ConfirmDialog |
Silme onayý |
StatusBadge |
Order status gösterimi |
Pagination |
Sayfalama kontrolü |
LoadingSpinner |
Yüklenme animasyonu |
Toast/Notification |
Baþarý/hata mesajlarý |
Form |
Validasyonlu form |
Select/Dropdown |
Customer/Product seçimi |
??????????? ???????? ??????????? ?????????????
? Pending ?---->? Paid ?---->? Shipped ?---->? Delivered ?
??????????? ???????? ??????????? ?????????????
? ?
? ????????????
? ?
v v
?????????????
? Cancelled ?
?????????????
Status Renkleri:
- Pending:
yellow/warning - Paid:
blue/info - Shipped:
purple - Delivered:
green/success - Cancelled:
red/danger
API'ye CORS eklenmelidir:
// Program.cs'e eklenecek
builder.Services.AddCors(options =>
{
options.AddPolicy("AllowUI", policy =>
{
policy.WithOrigins("http://localhost:3000", "http://localhost:5173")
.AllowAnyHeader()
.AllowAnyMethod();
});
});
// app.UseHttpsRedirection(); satýrýndan önce
app.UseCors("AllowUI");ui/
??? src/
? ??? components/
? ? ??? Layout/
? ? ??? DataTable/
? ? ??? Modal/
? ? ??? StatusBadge/
? ? ??? ...
? ??? pages/
? ? ??? Dashboard/
? ? ??? Customers/
? ? ??? Products/
? ? ??? Orders/
? ??? services/
? ? ??? customerService.ts
? ? ??? productService.ts
? ? ??? orderService.ts
? ??? types/
? ? ??? index.ts
? ??? hooks/
? ? ??? useApi.ts
? ??? App.tsx
??? package.json
??? README.md
- API Zaten Hazýr - Tüm endpoint'ler çalýþýr durumda
- SQLite DB -
app.dbdosyasý API baþlatýldýðýnda otomatik oluþur - Scalar UI - API test için
https://localhost:7142/scalar/v1kullanýlabilir - Validation - Backend'de validation var, frontend'de de olmalý
- Error Handling - 404, 400 durumlarý handle edilmeli
- Müþteri listesi görüntüleme
- Sayfalama çalýþýyor
- Yeni müþteri oluþturma
- Müþteri güncelleme
- Müþteri silme
- Email ile arama
- Ürün listesi görüntüleme
- Sayfalama çalýþýyor
- Yeni ürün oluþturma
- Ürün güncelleme
- Ürün silme
- Sipariþ listesi görüntüleme
- Sipariþ detayý görüntüleme
- Yeni sipariþ oluþturma (çoklu item)
- Sipariþ ödeme (Pending -> Paid)
- Sipariþ kargolama (Paid -> Shipped)
- Sipariþ teslim (Shipped -> Delivered)
- Sipariþ iptal (Pending/Paid -> Cancelled)
- Müþteriye göre filtreleme
Created for DapperCleanSample Project