public TopicPagingObject GetTopicsByIndex(int index, int numberPerPage, bool isActive, IUnitOfWork unitOfWork) { ValidateUnitOfWork(unitOfWork); string procedureName = "dbo.GetTopicsByIndex"; var parameters = new { Index = index, NumberPerPage = numberPerPage, IsActive = isActive }; TopicPagingObject topicPaging; using (var reader = unitOfWork.QueryMultiple(procedureName, parameters, commandType: CommandType.StoredProcedure)) { topicPaging = new TopicPagingObject() { Topics = reader.Read<BusinessObject.Topic>().ToList(), NumberOfTopic = reader.Read<int>().SingleOrDefault() }; } return topicPaging; }
public BusinessObject.Topic GetTopicById(int topicId, IUnitOfWork unitOfWork) { ValidateUnitOfWork(unitOfWork); string procedureName = "dbo.GetTopicById"; var parameters = new { TopicId = topicId }; var result = unitOfWork.Query<BusinessObject.Topic>(procedureName, parameters, commandType: CommandType.StoredProcedure).SingleOrDefault(); return result; }