public TopicInfoViewModel GetTopicInfoViewModelById(int topicId) { var topicShowViewModel = new TopicInfoViewModel(); try { TopicsViewEntity topicViewEntity = _topicRepository.GetTopicById(topicId, _connectionFactory); topicShowViewModel = Mapper.Map <TopicsViewEntity, TopicInfoViewModel>(topicViewEntity); } catch (Exception exception) { DemLogger.Current.Error(exception, $"{nameof(TopicReadService)}. Error in function {DemLogger.GetCallerInfo()}"); } return(topicShowViewModel); }
public TopicsViewEntity GetTopicById(int topicId, IConnectionFactory connectionFactory) { TopicsViewEntity topicViewEntity = new TopicsViewEntity(); try { using (var connection = connectionFactory.Create()) { topicViewEntity = connection.Query <TopicsViewEntity>(SqlCommandStorageService.GetTopicViewById(), new { topicId }).SingleOrDefault(); } } catch (Exception exception) { DemLogger.Current.Error(exception, $"{nameof(TopicRepository)}. Error in function {DemLogger.GetCallerInfo()}"); } return(topicViewEntity); }