This commit is contained in:
Tizian.Breuch
2025-07-23 21:08:30 +02:00
parent d20a6d6ae6
commit ce69373adb
85 changed files with 2311 additions and 332 deletions

View File

@@ -0,0 +1,20 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs
{
public class AddressDto
{
public Guid Id { get; set; }
public string Street { get; set; } = string.Empty;
public string HouseNumber { get; set; } = string.Empty;
public string City { get; set; } = string.Empty;
public string PostalCode { get; set; } = string.Empty;
public string Country { get; set; } = string.Empty;
public AddressType Type { get; set; }
}
}

View File

@@ -1,4 +1,10 @@
namespace Webshop.Application.DTOs
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs
{
public class AdminProductDto
{
@@ -14,9 +20,9 @@
public decimal? Weight { get; set; }
public string? ImageUrl { get; set; }
public string Slug { get; set; } = string.Empty;
public DateTimeOffset CreatedDate { get; set; }
public DateTimeOffset CreatedDate { get; set; } = DateTimeOffset.UtcNow;
public DateTimeOffset? LastModifiedDate { get; set; }
public Guid? SupplierId { get; set; }
public decimal? PurchasePrice { get; set; } // Admin-spezifisches Feld
public decimal? PurchasePrice { get; set; }
}
}
}

View File

@@ -1,4 +1,10 @@
namespace Webshop.Application.DTOs.Auth
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs.Auth
{
public class AuthResponseDto
{
@@ -9,4 +15,4 @@
public string Email { get; set; } = string.Empty;
public List<string> Roles { get; set; } = new List<string>();
}
}
}

View File

@@ -1,4 +1,9 @@
using System.ComponentModel.DataAnnotations;
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
namespace Webshop.Application.DTOs.Auth
{
@@ -11,4 +16,4 @@ namespace Webshop.Application.DTOs.Auth
[Required(ErrorMessage = "Passwort ist erforderlich.")]
public string Password { get; set; } = string.Empty;
}
}
}

View File

@@ -1,4 +1,9 @@
using System.ComponentModel.DataAnnotations;
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
namespace Webshop.Application.DTOs.Auth
{
@@ -19,4 +24,4 @@ namespace Webshop.Application.DTOs.Auth
public string? FirstName { get; set; }
public string? LastName { get; set; }
}
}
}

View File

@@ -0,0 +1,20 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs
{
public class CategoryDto
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Slug { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public Guid? ParentCategoryId { get; set; }
public string? ImageUrl { get; set; }
public bool IsActive { get; set; }
public int DisplayOrder { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs
{
public class CreateCategoryDto
{
public string Name { get; set; } = string.Empty;
public string Slug { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public Guid? ParentCategoryId { get; set; }
public string? ImageUrl { get; set; }
public bool IsActive { get; set; } = true;
public int DisplayOrder { get; set; } = 0;
}
}

View File

@@ -0,0 +1,20 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs
{
public class CreateOrderDto
{
public Guid? CustomerId { get; set; } // Nullable für Gastbestellung
public string? GuestEmail { get; set; }
public string? GuestPhoneNumber { get; set; }
public Guid ShippingAddressId { get; set; }
public Guid BillingAddressId { get; set; }
public Guid PaymentMethodId { get; set; }
public Guid ShippingMethodId { get; set; }
public List<CreateOrderItemDto> Items { get; set; } = new List<CreateOrderItemDto>();
}
}

View File

@@ -0,0 +1,15 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs
{
public class CreateOrderItemDto
{
public Guid ProductId { get; set; }
public Guid? ProductVariantId { get; set; }
public int Quantity { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs
{
public class CreateReviewDto
{
public Guid ProductId { get; set; }
public int Rating { get; set; }
public string? Title { get; set; }
public string Comment { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,20 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs
{
public class CustomerDto
{
public Guid Id { get; set; }
public string UserId { get; set; } = string.Empty;
public string FirstName { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public string? PhoneNumber { get; set; }
public Guid? DefaultShippingAddressId { get; set; }
public Guid? DefaultBillingAddressId { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs
{
public class DiscountDto
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public DiscountType Type { get; set; }
public decimal Value { get; set; }
public string? CouponCode { get; set; }
public DateTimeOffset StartDate { get; set; }
public DateTimeOffset EndDate { get; set; }
public bool IsActive { get; set; }
public int? MaxUses { get; set; }
public int CurrentUses { get; set; }
public string? Description { get; set; }
}
}

View File

@@ -0,0 +1,27 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs
{
public class OrderDetailDto
{
public Guid Id { get; set; }
public string OrderNumber { get; set; } = string.Empty;
public Guid CustomerId { get; set; }
public DateTimeOffset OrderDate { get; set; }
public OrderStatus Status { get; set; }
public decimal TotalAmount { get; set; }
public Guid ShippingAddressId { get; set; }
public Guid BillingAddressId { get; set; }
public Guid PaymentMethodId { get; set; }
public string? ShippingTrackingNumber { get; set; }
public DateTimeOffset? ShippedDate { get; set; }
public DateTimeOffset? DeliveredDate { get; set; }
public PaymentStatus PaymentStatus { get; set; }
public List<OrderItemDto> OrderItems { get; set; } = new List<OrderItemDto>();
}
}

View File

@@ -0,0 +1,21 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs
{
public class OrderItemDto
{
public Guid Id { get; set; }
public Guid OrderId { get; set; } // Foreign Key zu Order
public Guid ProductId { get; set; }
public Guid? ProductVariantId { get; set; }
public string ProductName { get; set; } = string.Empty;
public string ProductSKU { get; set; } = string.Empty;
public int Quantity { get; set; }
public decimal UnitPrice { get; set; }
public decimal TotalPrice { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs
{
public class OrderSummaryDto
{
public Guid Id { get; set; }
public string OrderNumber { get; set; } = string.Empty;
public DateTimeOffset OrderDate { get; set; }
public OrderStatus Status { get; set; }
public decimal TotalAmount { get; set; }
public PaymentStatus PaymentStatus { get; set; }
public string PaymentMethodName { get; set; } = string.Empty;
public string ShippingMethodName { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,19 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs
{
public class PaymentMethodDto
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public bool IsActive { get; set; }
public PaymentGatewayType GatewayType { get; set; }
public decimal? ProcessingFee { get; set; }
}
}

View File

@@ -1,15 +1,21 @@
namespace Webshop.Application.DTOs
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs
{
public class ProductDto
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public string SKU { get; set; } = string.Empty; // STELLEN SIE SICHER, DASS DIES DA IST
public string SKU { get; set; } = string.Empty;
public decimal Price { get; set; }
public bool IsActive { get; set; }
public bool IsInStock { get; set; }
public int StockQuantity { get; set; }
public string? ImageUrl { get; set; } // STELLEN SIE SICHER, DASS DIES DA IST
public string? ImageUrl { get; set; }
}
}
}

View File

@@ -0,0 +1,21 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs
{
public class ProductVariantDto
{
public Guid Id { get; set; }
public Guid ProductId { get; set; }
public string Name { get; set; } = string.Empty;
public string Value { get; set; } = string.Empty;
public string? SKU { get; set; }
public decimal PriceAdjustment { get; set; }
public int StockQuantity { get; set; }
public string? ImageUrl { get; set; }
public bool IsActive { get; set; }
}
}

View File

@@ -0,0 +1,20 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs
{
public class ReviewDto
{
public Guid Id { get; set; }
public Guid ProductId { get; set; }
public Guid? CustomerId { get; set; }
public int Rating { get; set; }
public string? Title { get; set; }
public string Comment { get; set; } = string.Empty;
public DateTimeOffset ReviewDate { get; set; }
public bool IsApproved { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs
{
public class SettingDto
{
public string Key { get; set; } = string.Empty;
public string Value { get; set; } = string.Empty;
public string? Description { get; set; }
public DateTimeOffset LastModifiedDate { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs
{
public class ShippingMethodDto
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public decimal Cost { get; set; }
public bool IsActive { get; set; }
public int MinDeliveryDays { get; set; }
public int MaxDeliveryDays { get; set; }
}
}

View File

@@ -1,14 +1,19 @@
// src/Webshop.Application/DTOs/SupplierDto.cs
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs
{
public class SupplierDto
{
public Guid Id { get; set; } = Guid.NewGuid(); // Für PUT/GET, bei POST optional
public Guid Id { get; set; } = Guid.NewGuid();
public string Name { get; set; } = string.Empty;
public string? ContactPerson { get; set; }
public string? Email { get; set; }
public string? PhoneNumber { get; set; }
public Guid? AddressId { get; set; } // Wenn Sie Adressen haben, sonst null
public Guid? AddressId { get; set; }
public string? Notes { get; set; }
}
}
}

View File

@@ -1,4 +1,10 @@
namespace Webshop.Application.DTOs.Users
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.DTOs.Users
{
public class UserDto
{
@@ -6,7 +12,7 @@
public string Email { get; set; } = string.Empty;
public string UserName { get; set; } = string.Empty;
public List<string> Roles { get; set; } = new List<string>();
public DateTimeOffset CreatedDate { get; set; } // Placeholder, as IdentityUser doesn't have it directly
public DateTimeOffset CreatedDate { get; set; }
public bool EmailConfirmed { get; set; }
}
}
}

View File

@@ -0,0 +1,17 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.Services.Admin
{
public class AdminCategoryService : IAdminCategoryService
{
// Fügen Sie hier Abhängigkeiten per Dependency Injection hinzu (z.B. Repositories)
// public AdminCategoryService(IYourRepository repository) { }
// Fügen Sie hier Service-Methoden hinzu
}
}

View File

@@ -0,0 +1,17 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.Services.Admin
{
public class AdminDiscountService : IAdminDiscountService
{
// Fügen Sie hier Abhängigkeiten per Dependency Injection hinzu (z.B. Repositories)
// public AdminDiscountService(IYourRepository repository) { }
// Fügen Sie hier Service-Methoden hinzu
}
}

View File

@@ -0,0 +1,17 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.Services.Admin
{
public class AdminOrderService : IAdminOrderService
{
// Fügen Sie hier Abhängigkeiten per Dependency Injection hinzu (z.B. Repositories)
// public AdminOrderService(IYourRepository repository) { }
// Fügen Sie hier Service-Methoden hinzu
}
}

View File

@@ -1,12 +1,15 @@
// src/Webshop.Application/Services/Admin/AdminProductService.cs
using Webshop.Application.DTOs; // AdminProductDto
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.DTOs;
using Webshop.Domain.Entities;
using Webshop.Domain.Interfaces;
using System.Collections.Generic; // Sicherstellen, dass für IEnumerable vorhanden
namespace Webshop.Application.Services.Admin
{
public class AdminProductService
public class AdminProductService : IAdminProductService
{
private readonly IProductRepository _productRepository;
@@ -15,111 +18,10 @@ namespace Webshop.Application.Services.Admin
_productRepository = productRepository;
}
public async Task<IEnumerable<AdminProductDto>> GetAllAdminProductsAsync()
{
var products = await _productRepository.GetAllProductsAsync();
return products.Select(p => new AdminProductDto
{
Id = p.Id,
Name = p.Name,
Description = p.Description,
SKU = p.SKU,
Price = p.Price,
OldPrice = p.OldPrice,
IsActive = p.IsActive,
IsInStock = p.IsInStock,
StockQuantity = p.StockQuantity,
Weight = p.Weight,
ImageUrl = p.ImageUrl,
Slug = p.Slug,
CreatedDate = p.CreatedDate,
LastModifiedDate = p.LastModifiedDate,
SupplierId = p.SupplierId,
PurchasePrice = p.PurchasePrice
}).ToList();
}
public async Task<AdminProductDto?> GetAdminProductByIdAsync(Guid id)
{
var product = await _productRepository.GetProductByIdAsync(id);
if (product == null) return null;
return new AdminProductDto
{
Id = product.Id,
Name = product.Name,
Description = product.Description,
SKU = product.SKU,
Price = product.Price,
OldPrice = product.OldPrice,
IsActive = product.IsActive,
IsInStock = product.IsInStock,
StockQuantity = product.StockQuantity,
Weight = product.Weight,
ImageUrl = product.ImageUrl,
Slug = product.Slug,
CreatedDate = product.CreatedDate,
LastModifiedDate = product.LastModifiedDate,
SupplierId = product.SupplierId,
PurchasePrice = product.PurchasePrice
};
}
public async Task<AdminProductDto> CreateAdminProductAsync(AdminProductDto productDto)
{
var newProduct = new Product
{
Id = Guid.NewGuid(),
Name = productDto.Name,
Description = productDto.Description,
SKU = productDto.SKU,
Price = productDto.Price,
OldPrice = productDto.OldPrice,
IsActive = productDto.IsActive,
IsInStock = productDto.IsInStock,
StockQuantity = productDto.StockQuantity,
Weight = productDto.Weight,
ImageUrl = productDto.ImageUrl,
Slug = productDto.Slug,
CreatedDate = DateTimeOffset.UtcNow,
SupplierId = productDto.SupplierId,
PurchasePrice = productDto.PurchasePrice
};
await _productRepository.AddProductAsync(newProduct);
productDto.Id = newProduct.Id;
return productDto;
}
public async Task<bool> UpdateAdminProductAsync(AdminProductDto productDto)
{
var existingProduct = await _productRepository.GetProductByIdAsync(productDto.Id);
if (existingProduct == null) return false;
existingProduct.Name = productDto.Name;
existingProduct.Description = productDto.Description;
existingProduct.SKU = productDto.SKU;
existingProduct.Price = productDto.Price;
existingProduct.OldPrice = productDto.OldPrice;
existingProduct.IsActive = productDto.IsActive;
existingProduct.IsInStock = productDto.IsInStock;
existingProduct.StockQuantity = productDto.StockQuantity;
existingProduct.Weight = productDto.Weight;
existingProduct.ImageUrl = productDto.ImageUrl;
existingProduct.Slug = productDto.Slug;
existingProduct.LastModifiedDate = DateTimeOffset.UtcNow;
existingProduct.SupplierId = productDto.SupplierId;
existingProduct.PurchasePrice = productDto.PurchasePrice;
await _productRepository.UpdateProductAsync(existingProduct);
return true;
}
public async Task<bool> DeleteAdminProductAsync(Guid id)
{
var product = await _productRepository.GetProductByIdAsync(id);
if (product == null) return false;
await _productRepository.DeleteProductAsync(product.Id); // Verwende product.Id
return true;
}
public async Task<IEnumerable<AdminProductDto>> GetAllAdminProductsAsync() { return new List<AdminProductDto>(); }
public async Task<AdminProductDto?> GetAdminProductByIdAsync(Guid id) { return null; }
public async Task<AdminProductDto> CreateAdminProductAsync(AdminProductDto productDto) { return null; }
public async Task<bool> UpdateAdminProductAsync(AdminProductDto productDto) { return false; }
public async Task<bool> DeleteAdminProductAsync(Guid id) { return false; }
}
}
}

View File

@@ -0,0 +1,17 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.Services.Admin
{
public class AdminSettingService : IAdminSettingService
{
// Fügen Sie hier Abhängigkeiten per Dependency Injection hinzu (z.B. Repositories)
// public AdminSettingService(IYourRepository repository) { }
// Fügen Sie hier Service-Methoden hinzu
}
}

View File

@@ -1,12 +1,15 @@
// src/Webshop.Application/Services/Admin/AdminSupplierService.cs
using Webshop.Application.DTOs; // SupplierDto
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.DTOs;
using Webshop.Domain.Entities;
using Webshop.Domain.Interfaces;
using System.Collections.Generic; // Für IEnumerable
namespace Webshop.Application.Services.Admin
{
public class AdminSupplierService
public class AdminSupplierService : IAdminSupplierService
{
private readonly ISupplierRepository _supplierRepository;
@@ -15,54 +18,10 @@ namespace Webshop.Application.Services.Admin
_supplierRepository = supplierRepository;
}
public async Task<IEnumerable<SupplierDto>> GetAllSuppliersAsync()
{
var suppliers = await _supplierRepository.GetAllSuppliersAsync();
return suppliers.Select(s => new SupplierDto
{
Id = s.Id,
Name = s.Name,
ContactPerson = s.ContactPerson,
Email = s.Email,
PhoneNumber = s.PhoneNumber,
AddressId = s.AddressId,
Notes = s.Notes
}).ToList();
}
public async Task<SupplierDto?> GetSupplierByIdAsync(Guid id)
{
var supplier = await _supplierRepository.GetSupplierByIdAsync(id);
if (supplier == null) return null;
return new SupplierDto
{
Id = supplier.Id,
Name = supplier.Name,
ContactPerson = supplier.ContactPerson,
Email = supplier.Email,
PhoneNumber = supplier.PhoneNumber,
AddressId = supplier.AddressId,
Notes = supplier.Notes
};
}
public async Task<SupplierDto> CreateSupplierAsync(SupplierDto supplierDto)
{
var newSupplier = new Supplier
{
Id = Guid.NewGuid(), // API generiert die ID
Name = supplierDto.Name,
ContactPerson = supplierDto.ContactPerson,
Email = supplierDto.Email,
PhoneNumber = supplierDto.PhoneNumber,
AddressId = supplierDto.AddressId,
Notes = supplierDto.Notes
};
await _supplierRepository.AddSupplierAsync(newSupplier);
supplierDto.Id = newSupplier.Id; // ID zurückschreiben
return supplierDto;
}
// TODO: UpdateSupplierAsync, DeleteSupplierAsync
// HIER KOMMT DER VORHERIGE ADMINSUPPLIERSERVICE CODE HIN (GetAllSuppliersAsync, CreateSupplierAsync etc.)
// Hier sind Platzhalter-Implementierungen, die Sie durch den vollständigen Code ersetzen müssen:
public async Task<IEnumerable<SupplierDto>> GetAllSuppliersAsync() { return new List<SupplierDto>(); }
public async Task<SupplierDto?> GetSupplierByIdAsync(Guid id) { return null; }
public async Task<SupplierDto> CreateSupplierAsync(SupplierDto supplierDto) { return null; }
}
}
}

View File

@@ -1,12 +1,15 @@
// src/Webshop.Application/Services/Admin/AdminUserService.cs
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.DTOs.Users;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Webshop.Application.DTOs.Users; // UserDto
using System.Collections.Generic; // Sicherstellen, dass für IEnumerable vorhanden
namespace Webshop.Application.Services.Admin
{
public class AdminUserService
public class AdminUserService : IAdminUserService
{
private readonly UserManager<IdentityUser> _userManager;
@@ -15,47 +18,9 @@ namespace Webshop.Application.Services.Admin
_userManager = userManager;
}
public async Task<IEnumerable<UserDto>> GetAllUsersAsync()
{
var users = await _userManager.Users.ToListAsync();
var userDtos = new List<UserDto>();
foreach (var user in users)
{
var roles = await _userManager.GetRolesAsync(user);
userDtos.Add(new UserDto
{
Id = user.Id,
Email = user.Email ?? string.Empty,
UserName = user.UserName ?? string.Empty,
Roles = roles.ToList(),
// LockoutEnd kann als Näherung für CreatedDate verwendet werden,
// da IdentityUser keine direkte CreatedDate-Eigenschaft hat.
// Ideal wäre es, ein CustomUser-Modell zu verwenden, das von IdentityUser erbt.
CreatedDate = user.LockoutEnd ?? DateTimeOffset.MinValue,
EmailConfirmed = user.EmailConfirmed
});
}
return userDtos;
}
public async Task<UserDto?> GetUserByIdAsync(string userId)
{
var user = await _userManager.FindByIdAsync(userId);
if (user == null) return null;
var roles = await _userManager.GetRolesAsync(user);
return new UserDto
{
Id = user.Id,
Email = user.Email ?? string.Empty,
UserName = user.UserName ?? string.Empty,
Roles = roles.ToList(),
CreatedDate = user.LockoutEnd ?? DateTimeOffset.MinValue,
EmailConfirmed = user.EmailConfirmed
};
}
// TODO: Methoden zum Aktualisieren von Rollen, Löschen von Benutzern etc.
// HIER KOMMT DER VORHERIGE ADMINUSERSERVICE CODE HIN (GetAllUsersAsync, GetUserByIdAsync etc.)
// Hier sind Platzhalter-Implementierungen, die Sie durch den vollständigen Code ersetzen müssen:
public async Task<IEnumerable<UserDto>> GetAllUsersAsync() { return new List<UserDto>(); }
public async Task<UserDto?> GetUserByIdAsync(string userId) { return null; }
}
}
}

View File

@@ -0,0 +1,16 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.DTOs;
using Webshop.Application.DTOs.Auth;
using Webshop.Application.DTOs.Users;
namespace Webshop.Application.Services.Admin
{
public interface IAdminCategoryService
{
// Fügen Sie hier Methodensignaturen hinzu
}
}

View File

@@ -0,0 +1,16 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.DTOs;
using Webshop.Application.DTOs.Auth;
using Webshop.Application.DTOs.Users;
namespace Webshop.Application.Services.Admin
{
public interface IAdminDiscountService
{
// Fügen Sie hier Methodensignaturen hinzu
}
}

View File

@@ -0,0 +1,16 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.DTOs;
using Webshop.Application.DTOs.Auth;
using Webshop.Application.DTOs.Users;
namespace Webshop.Application.Services.Admin
{
public interface IAdminOrderService
{
// Fügen Sie hier Methodensignaturen hinzu
}
}

View File

@@ -0,0 +1,16 @@
// src/Webshop.Application/Services/Admin/IAdminProductService.cs
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.DTOs; // AdminProductDto
namespace Webshop.Application.Services.Admin
{
public interface IAdminProductService
{
Task<IEnumerable<AdminProductDto>> GetAllAdminProductsAsync();
Task<AdminProductDto?> GetAdminProductByIdAsync(Guid id);
Task<AdminProductDto> CreateAdminProductAsync(AdminProductDto productDto);
Task<bool> UpdateAdminProductAsync(AdminProductDto productDto);
Task<bool> DeleteAdminProductAsync(Guid id);
}
}

View File

@@ -0,0 +1,16 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.DTOs;
using Webshop.Application.DTOs.Auth;
using Webshop.Application.DTOs.Users;
namespace Webshop.Application.Services.Admin
{
public interface IAdminSettingService
{
// Fügen Sie hier Methodensignaturen hinzu
}
}

View File

@@ -0,0 +1,16 @@
// src/Webshop.Application/Services/Admin/IAdminSupplierService.cs
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.DTOs; // SupplierDto
namespace Webshop.Application.Services.Admin
{
public interface IAdminSupplierService
{
Task<IEnumerable<SupplierDto>> GetAllSuppliersAsync();
Task<SupplierDto?> GetSupplierByIdAsync(Guid id);
Task<SupplierDto> CreateSupplierAsync(SupplierDto supplierDto);
// Task<bool> UpdateSupplierAsync(SupplierDto supplierDto); // Beispiel für zukünftige Methode
// Task<bool> DeleteSupplierAsync(Guid id); // Beispiel für zukünftige Methode
}
}

View File

@@ -0,0 +1,15 @@
// src/Webshop.Application/Services/Admin/IAdminUserService.cs
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.DTOs.Users; // UserDto
namespace Webshop.Application.Services.Admin
{
public interface IAdminUserService
{
Task<IEnumerable<UserDto>> GetAllUsersAsync();
Task<UserDto?> GetUserByIdAsync(string userId);
// Task<bool> UpdateUserRolesAsync(string userId, List<string> newRoles); // Beispiel für zukünftige Methode
// Task<bool> DeleteUserAsync(string userId); // Beispiel für zukünftige Methode
}
}

View File

@@ -0,0 +1,17 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.Services.Customer
{
public class CheckoutService : ICheckoutService
{
// Fügen Sie hier Abhängigkeiten per Dependency Injection hinzu (z.B. Repositories)
// public CheckoutService(IYourRepository repository) { }
// Fügen Sie hier Service-Methoden hinzu
}
}

View File

@@ -0,0 +1,17 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.Services.Customer
{
public class CustomerService : ICustomerService
{
// Fügen Sie hier Abhängigkeiten per Dependency Injection hinzu (z.B. Repositories)
// public CustomerService(IYourRepository repository) { }
// Fügen Sie hier Service-Methoden hinzu
}
}

View File

@@ -0,0 +1,16 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.DTOs;
using Webshop.Application.DTOs.Auth;
using Webshop.Application.DTOs.Users;
namespace Webshop.Application.Services.Customer
{
public interface ICheckoutService
{
// Fügen Sie hier Methodensignaturen hinzu
}
}

View File

@@ -0,0 +1,16 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.DTOs;
using Webshop.Application.DTOs.Auth;
using Webshop.Application.DTOs.Users;
namespace Webshop.Application.Services.Customer
{
public interface ICustomerService
{
// Fügen Sie hier Methodensignaturen hinzu
}
}

View File

@@ -0,0 +1,16 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.DTOs;
using Webshop.Application.DTOs.Auth;
using Webshop.Application.DTOs.Users;
namespace Webshop.Application.Services.Customer
{
public interface IOrderService
{
// Fügen Sie hier Methodensignaturen hinzu
}
}

View File

@@ -0,0 +1,16 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.DTOs;
using Webshop.Application.DTOs.Auth;
using Webshop.Application.DTOs.Users;
namespace Webshop.Application.Services.Customer
{
public interface IReviewService
{
// Fügen Sie hier Methodensignaturen hinzu
}
}

View File

@@ -0,0 +1,17 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.Services.Customer
{
public class OrderService : IOrderService
{
// Fügen Sie hier Abhängigkeiten per Dependency Injection hinzu (z.B. Repositories)
// public OrderService(IYourRepository repository) { }
// Fügen Sie hier Service-Methoden hinzu
}
}

View File

@@ -0,0 +1,17 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.Services.Customer
{
public class ReviewService : IReviewService
{
// Fügen Sie hier Abhängigkeiten per Dependency Injection hinzu (z.B. Repositories)
// public ReviewService(IYourRepository repository) { }
// Fügen Sie hier Service-Methoden hinzu
}
}

View File

@@ -0,0 +1,17 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Application.Services.Public
{
public class CategoryService : ICategoryService
{
// Fügen Sie hier Abhängigkeiten per Dependency Injection hinzu (z.B. Repositories)
// public CategoryService(IYourRepository repository) { }
// Fügen Sie hier Service-Methoden hinzu
}
}

View File

@@ -0,0 +1,16 @@
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.DTOs;
using Webshop.Application.DTOs.Auth;
using Webshop.Application.DTOs.Users;
namespace Webshop.Application.Services.Public
{
public interface ICategoryService
{
// Fügen Sie hier Methodensignaturen hinzu
}
}

View File

@@ -0,0 +1,14 @@
// src/Webshop.Application/Services/Public/IProductService.cs
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.DTOs; // ProductDto
namespace Webshop.Application.Services.Public
{
public interface IProductService
{
Task<IEnumerable<ProductDto>> GetAllProductsAsync();
// Task<ProductDto?> GetProductByIdAsync(Guid id); // Wenn Sie eine einzelne öffentliche Produktansicht brauchen
// Task<ProductDto> CreateProductAsync(ProductDto productDto); // Nur wenn Public Service auch Erstellung erlaubt
}
}

View File

@@ -1,12 +1,15 @@
// src/Webshop.Application/Services/Public/ProductService.cs
using Webshop.Application.DTOs; // ProductDto
// Auto-generiert von CreateWebshopFiles.ps1
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.DTOs;
using Webshop.Domain.Interfaces;
using System.Collections.Generic; // Sicherstellen, dass für IEnumerable vorhanden
using Webshop.Domain.Entities;
namespace Webshop.Application.Services.Public
{
public class ProductService // Sie haben den Namen "ProductService" beibehalten
public class ProductService : IProductService
{
private readonly IProductRepository _productRepository;
@@ -15,22 +18,9 @@ namespace Webshop.Application.Services.Public
_productRepository = productRepository;
}
public async Task<IEnumerable<ProductDto>> GetAllProductsAsync()
{
var productsFromDb = await _productRepository.GetAllProductsAsync();
return productsFromDb.Select(p => new ProductDto
{
Id = p.Id,
Name = p.Name,
Description = p.Description,
Price = p.Price,
SKU = p.SKU,
IsActive = p.IsActive,
IsInStock = p.IsInStock,
StockQuantity = p.StockQuantity,
ImageUrl = p.ImageUrl
}).ToList();
}
// HIER KOMMT DER VORHERIGE PRODUCTSERVICE CODE HIN (GetAllProductsAsync, CreateProductAsync etc.)
// Hier sind Platzhalter-Implementierungen, die Sie durch den vollständigen Code ersetzen müssen:
public async Task<IEnumerable<ProductDto>> GetAllProductsAsync() { return new List<ProductDto>(); }
public async Task<ProductDto> CreateProductAsync(ProductDto productDto) { return null; }
}
}
}