You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IGetCustomerService.cs 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using Karsha_Site.Application.Interfaces.Contexts;
  2. using Karsha_Site.Application.Services.Costomers.Queries.GetCustomers;
  3. using Karsha_Site.Common.Dto;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace Karsha_Site.Application.Services.Common.Queries.GetCustomer
  10. {
  11. public interface IGetCustomerService
  12. {
  13. ResultDto<List<GetAboutAddressDto>> Execute();
  14. }
  15. public class GetCustomerService : IGetCustomerService
  16. {
  17. private readonly IDataBaseContext _context;
  18. public GetCustomerService(IDataBaseContext context)
  19. {
  20. _context = context;
  21. }
  22. public ResultDto<List<GetAboutAddressDto>> Execute()
  23. {
  24. var customers = _context.Customers
  25. .ToList()
  26. .Select(p => new GetAboutAddressDto
  27. {
  28. ID = p.ID,
  29. FullName = p.FullName,
  30. Image = p.Image,
  31. Link = p.Link,
  32. }).ToList();
  33. return new ResultDto<List<GetAboutAddressDto>>()
  34. {
  35. Data = customers,
  36. IsSuccess = true,
  37. };
  38. }
  39. }
  40. }