Beispiel #1
0
        public ForumInfoViewModel GetForumInfoViewModelById(int forumId)
        {
            var forumInfoViewModel = new ForumInfoViewModel();

            try
            {
                ForumsViewEntity forumViewEntity = _forumRepository.GetForumInfoById(forumId, _connectionFactory);
                forumInfoViewModel = Mapper.Map <ForumsViewEntity, ForumInfoViewModel>(forumViewEntity);
            }
            catch (Exception exception)
            {
                DemLogger.Current.Error(exception, $"{nameof(ForumReadService)}. Error in function {DemLogger.GetCallerInfo()}");
            }
            return(forumInfoViewModel);
        }
Beispiel #2
0
        public ForumsViewEntity GetForumInfoById(int forumId, IConnectionFactory connectionFactory)
        {
            ForumsViewEntity forumsViewEntity = new ForumsViewEntity();

            try
            {
                using (var connection = connectionFactory.Create())
                {
                    forumsViewEntity = connection.Query <ForumsViewEntity>(SqlCommandStorageService.GetForumViewInfoById(), new { forumId }).SingleOrDefault();
                }
            }
            catch (Exception exception)
            {
                DemLogger.Current.Error(exception, $"{nameof(ForumsViewRepository)}. Error in function {DemLogger.GetCallerInfo()}");
            }
            return(forumsViewEntity);
        }