using Karsha_Site.Application.Interfaces.Contexts; using Karsha_Site.Common.Dto; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Karsha_Site.Application.Services.About.Commands.RemoveAboutTels { public interface IRemoveAboutTelsService { ResultDto Execute(int customerId); } public class RemoveCustomerService : IRemoveAboutTelsService { private readonly IDataBaseContext _context; public RemoveCustomerService(IDataBaseContext context) { _context = context; } public ResultDto Execute(int aboutTelsId) { var customer = _context.AboutTels.Find(aboutTelsId); if (customer == null) { return new ResultDto { IsSuccess = false, Message = "تلفن یافت نشد" }; } customer.RemoveTime = DateTime.Now; customer.IsRemoved = true; _context.SaveChanges(); return new ResultDto() { IsSuccess = true, Message = "تلفن با موفقیت حذف شد" }; } } }