using Aspose.Words.Lists; using AutoMapper; using NPOI.SS.Formula.Functions; using OASystem.Domain.Entities.Customer; using OASystem.Domain.Entities.Groups; using OASystem.Domain.ViewModels.CRM; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OASystem.Infrastructure.Repositories.Groups { public class CheckBoxsRepository : BaseRepository { private readonly IMapper _mapper; public CheckBoxsRepository(SqlSugarClient sqlSugar, IMapper mapper) : base(sqlSugar) { _mapper = mapper; } public List GetCheckBoxsByDiid(int diid) { return Query(x=>x.Diid == diid).ToList(); } public bool AddCheckBoxs(List checkboxList) { return Adds(checkboxList) > 0; } public Task DelCheckBoxsByDiid(int diid) { return DeleteAsync(x => x.Diid == diid); } public async Task SaveCheckBoxs(List checkboxList,int diid) { BeginTran(); bool isTrue = await DelCheckBoxsByDiid(diid); if (checkboxList.Count > 0) { isTrue = AddCheckBoxs(checkboxList); } if (isTrue) { CommitTran(); } else { RollbackTran(); } return isTrue; } } }