aufrüumen

This commit is contained in:
Tizian.Breuch
2025-07-25 15:46:31 +02:00
parent 8218b860ca
commit 9e298a0458
74 changed files with 453 additions and 3557 deletions

View File

@@ -0,0 +1,52 @@
using System.Threading.Tasks;
using Webshop.Application.DTOs.Customers;
using Webshop.Application.Services.Customers.Interfaces;
using Webshop.Domain.Interfaces; // Wichtig für ICustomerRepository
namespace Webshop.Application.Services.Customers
{
public class CustomerService : ICustomerService
{
private readonly ICustomerRepository _customerRepository;
public CustomerService(ICustomerRepository customerRepository)
{
_customerRepository = customerRepository;
}
public async Task<CustomerDto?> GetMyProfileAsync(string userId)
{
var customer = await _customerRepository.GetByUserIdAsync(userId);
if (customer == null)
{
return null;
}
// Mappe die Entity auf das CustomerDto
return new CustomerDto
{
Id = customer.Id,
UserId = customer.AspNetUserId,
FirstName = customer.FirstName,
LastName = customer.LastName,
// Fügen Sie hier weitere Felder hinzu, die der Kunde sehen soll (Email, Phone etc.)
};
}
public async Task<bool> UpdateMyProfileAsync(string userId, UpdateCustomerProfileDto profileDto)
{
var customer = await _customerRepository.GetByUserIdAsync(userId);
if (customer == null)
{
return false; // Kunde nicht gefunden
}
// Aktualisiere die Felder
customer.FirstName = profileDto.FirstName;
customer.LastName = profileDto.LastName;
await _customerRepository.UpdateAsync(customer);
return true;
}
}
}