示例#1
0
        private ActionResult PostsForTown(string key)
        {
            ResultDTO <List <PostInfo> > rs = null;

            Task t1 = Task.Run(() => {
                TownService service = new TownService();
                rs = service.GetPosts(key);
            });

            Task t2 = Task.Run(() => {
                TownService tService  = new TownService();
                ViewData["TownItems"] = tService.Get(this.HttpContext);
            });

            Task.WaitAll(new Task[] { t1, t2 });
            if (rs.Code < 0)
            {
                _log.Error(rs.Message);
            }

            if (rs.Data == null)
            {
                rs.Data = new List <PostInfo>();
            }

            return(View("~/Views/Recruitment/Index.cshtml", rs.Data));
        }