using AutoMapper; using OASystem.Domain.Entities.Groups; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OASystem.Infrastructure.Repositories.Groups { public class GroupCostParameterRepository : BaseRepository { public GroupCostParameterRepository(SqlSugarClient sqlSugar) : base(sqlSugar) { } public List GetGroupCostParameterListByDiid(int diid) { return Query(x=>x.DiId == diid).ToList(); } public async Task DeleteGroupCostParameterListByDiid(int diid) { return await SoftDeleteAsync(x=>x.DiId == diid); } public async Task SaveAsync(List List,int Userid, int diid) { bool isTrue = false; try { BeginTran(); isTrue = await DeleteGroupCostParameterListByDiid(diid); if (List.Count > 0) { List.ForEach(x => { x.CreateUserId = Userid; x.CreateTime = DateTime.Now; }); isTrue = Adds(List) > 0; } CommitTran(); } catch (Exception ex) { RollbackTran(); isTrue = false; } return isTrue; } } }