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.RemoveAboutAddress { public interface IRemoveAboutAddressService { ResultDto Execute(int customerId); } public class RemoveCustomerService : IRemoveAboutAddressService { private readonly IDataBaseContext _context; public RemoveCustomerService(IDataBaseContext context) { _context = context; } public ResultDto Execute(int aboutAddressId) { var customer = _context.AboutAddress.Find(aboutAddressId); if (customer == null) { return new ResultDto { IsSuccess = false, Message = "آدرس یافت نشد" }; } customer.RemoveTime = DateTime.Now; customer.IsRemoved = true; _context.SaveChanges(); return new ResultDto() { IsSuccess = true, Message = "آدرس با موفقیت حذف شد" }; } } }