public async Task <ChecklistHistory> GetLatestChecklist(Scheme scheme) { var mapper = new ChecklistMapper(); var param = new DynamicParameters(); param.Add("@Scheme", scheme); return((await SqlMapper.QueryAsync(_unitOfWork.Connection, "GetLatestChecklist", new[] { typeof(ChecklistHistory), typeof(ChecklistCategory), typeof(ChecklistItem) }, obj => { var history = obj[0] as ChecklistHistory; var category = obj[1] as ChecklistCategory; var item = obj[2] as ChecklistItem; return mapper.Map(history, category, item); }, param, splitOn: "ID,CategoryID,ItemID", commandType: System.Data.CommandType.StoredProcedure))?.FirstOrDefault()); }
public async Task <IEnumerable <ChecklistHistory> > GetChecklistHistoryByScheme(int id) { var mapper = new ChecklistMapper(); var param = new DynamicParameters(); param.Add("@ID", id); return((await SqlMapper.QueryAsync(_unitOfWork.Connection, "GetChecklistHistoryByScheme", new[] { typeof(ChecklistHistory), typeof(ChecklistCategory), typeof(ChecklistItem) }, obj => { var history = obj[0] as ChecklistHistory; var category = obj[1] as ChecklistCategory; var item = obj[2] as ChecklistItem; return mapper.Map(history, category, item); }, param, splitOn: "ID,CategoryID,ItemID", commandType: System.Data.CommandType.StoredProcedure)).Distinct()); }
public async Task <ChecklistHistory> GetChecklistHistoryByID(long id) { var mapper = new ChecklistMapper(); var param = new DynamicParameters(); param.Add("@ID", id); return((await SqlMapper.QueryAsync(_unitOfWork.Connection, "GetChecklistHistoryByID", new[] { typeof(ChecklistHistory), typeof(ChecklistCategory), typeof(ChecklistItem) }, obj => { var history = obj[0] as ChecklistHistory; var category = obj[1] as ChecklistCategory; var item = obj[2] as ChecklistItem; return mapper.Map(history, category, item); }, param, splitOn: "ID,CategoryID,ItemID", commandType: CommandType.StoredProcedure, transaction: _unitOfWork.Transaction))?.FirstOrDefault()); }