aufrüumen
This commit is contained in:
18
Webshop.Application/Services/Customers/CheckoutService.cs
Normal file
18
Webshop.Application/Services/Customers/CheckoutService.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
// Auto-generiert von CreateWebshopFiles.ps1
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Webshop.Application.Services.Customers.Interfaces;
|
||||
|
||||
|
||||
namespace Webshop.Application.Services.Customers
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
||||
52
Webshop.Application/Services/Customers/CustomerService.cs
Normal file
52
Webshop.Application/Services/Customers/CustomerService.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.Customers.Interfaces
|
||||
{
|
||||
public interface ICheckoutService
|
||||
{
|
||||
// Fügen Sie hier Methodensignaturen hinzu
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System.Threading.Tasks;
|
||||
using Webshop.Application.DTOs.Customers; // Korrektes Using für DTOs
|
||||
|
||||
namespace Webshop.Application.Services.Customers.Interfaces
|
||||
{
|
||||
public interface ICustomerService
|
||||
{
|
||||
Task<CustomerDto?> GetMyProfileAsync(string userId);
|
||||
Task<bool> UpdateMyProfileAsync(string userId, UpdateCustomerProfileDto profileDto);
|
||||
}
|
||||
}
|
||||
@@ -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.Customers.Interfaces
|
||||
{
|
||||
public interface IOrderService
|
||||
{
|
||||
// Fügen Sie hier Methodensignaturen hinzu
|
||||
}
|
||||
}
|
||||
@@ -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.Customers.Interfaces
|
||||
{
|
||||
public interface IReviewService
|
||||
{
|
||||
// Fügen Sie hier Methodensignaturen hinzu
|
||||
}
|
||||
}
|
||||
18
Webshop.Application/Services/Customers/OrderService.cs
Normal file
18
Webshop.Application/Services/Customers/OrderService.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
// Auto-generiert von CreateWebshopFiles.ps1
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Webshop.Application.Services.Customers.Interfaces;
|
||||
|
||||
|
||||
namespace Webshop.Application.Services.Customers
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
||||
18
Webshop.Application/Services/Customers/ReviewService.cs
Normal file
18
Webshop.Application/Services/Customers/ReviewService.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
// Auto-generiert von CreateWebshopFiles.ps1
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Webshop.Application.Services.Customers.Interfaces;
|
||||
|
||||
|
||||
namespace Webshop.Application.Services.Customers
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user