示例#1
0
 public ActionResult Index(int id, string lang, string urlFriendlytitle)
 {
     ActionResult actionResult;
     CookieGetterAndSetter.SetLanguageCookie(lang);
     try
     {
         TopicDo topic = this._topicLogic.GetTopic(id);
         Topic topic1 = new Topic()
         {
             TopicNumber = topic.BlizzTopicId,
             GameAbbrev = topic.GameAbbrev.ToLower(),
             RegionAbbrev = topic.RegionAbbrev.ToLower(),
             RegionFullName = topic.RegionFullName,
             TopicTitle = topic.TopicTitle,
             HasMvpPosts = topic.HasMvpPosts,
             LanguageAbbrev = topic.LanguageAbbrev.ToLower(),
             UserLanguage = lang
         };
         Topic topicTitle = topic1;
         topicTitle.TopicTitle = topic.TopicTitle;
         topicTitle.GameFullName = SafeResourceFetcher.GetResource(string.Concat("Game_", topicTitle.GameAbbrev.ToUpper()), lang);
         foreach (PostDo post in topic.Posts)
         {
             Post post1 = new Post()
             {
                 PostContent = post.PostContent,
                 PosterName = post.PosterName,
                 PosterTitle = post.PosterTitle,
                 RawDateStr = post.RawDateStr,
                 SourceUri = post.SourceUri,
                 Type = (PosterType)post.Type,
                 Avatar = post.Avatar
             };
             topicTitle.Posts.Add(post1);
         }
         if (topicTitle.Posts.Count == 0)
         {
             throw new HttpException(404, "Not found.");
         }
         actionResult = base.View(topicTitle);
     }
     catch (OverflowException overflowException)
     {
         throw new HttpException(404, "Not found.");
     }
     catch (NullReferenceException nullReferenceException)
     {
         throw new HttpException(404, "Not found.");
     }
     return actionResult;
 }
示例#2
0
 public ActionResult MobileApp(int id, string lang, string game, string device)
 {
     ActionResult actionResult;
     try
     {
         TopicDo topic = this._topicLogic.GetTopic(id);
         Topic topic1 = new Topic()
         {
             TopicNumber = topic.BlizzTopicId,
             GameAbbrev = topic.GameAbbrev.ToLower(),
             GameFullName = topic.GameFullName,
             RegionAbbrev = topic.RegionAbbrev.ToLower(),
             RegionFullName = topic.RegionFullName,
             TopicTitle = topic.TopicTitle,
             HasMvpPosts = topic.HasMvpPosts,
             LanguageAbbrev = topic.LanguageAbbrev.ToLower()
         };
         Topic topicTitle = topic1;
         topicTitle.TopicTitle = topic.TopicTitle;
         foreach (PostDo post in topic.Posts)
         {
             Post post1 = new Post()
             {
                 PostContent = post.PostContent,
                 PosterName = post.PosterName,
                 PosterTitle = post.PosterTitle,
                 RawDateStr = post.RawDateStr,
                 SourceUri = post.SourceUri,
                 Type = (PosterType)post.Type,
                 Avatar = post.Avatar
             };
             topicTitle.Posts.Add(post1);
         }
         if (topicTitle.Posts.Count == 0)
         {
             throw new HttpException(404, "Not found.");
         }
         actionResult = base.View("MobileAppTopic", topicTitle);
     }
     catch (OverflowException overflowException)
     {
         throw new HttpException(404, "Not found.");
     }
     catch (NullReferenceException nullReferenceException)
     {
         throw new HttpException(404, "Not found.");
     }
     return actionResult;
 }