Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

IRemoveAboutTelsService.cs 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using Karsha_Site.Application.Interfaces.Contexts;
  2. using Karsha_Site.Common.Dto;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace Karsha_Site.Application.Services.About.Commands.RemoveAboutTels
  9. {
  10. public interface IRemoveAboutTelsService
  11. {
  12. ResultDto Execute(int customerId);
  13. }
  14. public class RemoveCustomerService : IRemoveAboutTelsService
  15. {
  16. private readonly IDataBaseContext _context;
  17. public RemoveCustomerService(IDataBaseContext context)
  18. {
  19. _context = context;
  20. }
  21. public ResultDto Execute(int aboutTelsId)
  22. {
  23. var customer = _context.AboutTels.Find(aboutTelsId);
  24. if (customer == null)
  25. {
  26. return new ResultDto
  27. {
  28. IsSuccess = false,
  29. Message = "تلفن یافت نشد"
  30. };
  31. }
  32. customer.RemoveTime = DateTime.Now;
  33. customer.IsRemoved = true;
  34. _context.SaveChanges();
  35. return new ResultDto()
  36. {
  37. IsSuccess = true,
  38. Message = "تلفن با موفقیت حذف شد"
  39. };
  40. }
  41. }
  42. }