// GET: Group public ActionResult GroupDetail(string groupCode) { MvcApplication.currentGroupCode = groupCode; GroupDetailModel gdm = null; GroupGetResponse ggr = _groupCom.GetGroup(groupCode).Result; if(ggr!=null) { gdm = new GroupDetailModel() { CourseCode = ggr.CourseCode, GroupCode = ggr.GroupCode, GroupName = ggr.GroupName, GroupTypeCode = ggr.GroupTypeCode, Objective = ggr.Objective, TimeZone = ggr.TimeZone, UserList = new List<GroupUserModel>(), GroupPosts = new List<PostModel>() }; foreach(var user in ggr.UserList) { gdm.UserList.Add(new GroupUserModel() { emailId = user.emailId, name = user.name }); } foreach(var posts in ggr.GroupPosts) { PostModel pm = new PostModel() { PostText = posts.PostText, TimePosted = posts.TimePosted, UserName = posts.UserName, }; if(posts.ChildPosts != null && posts.ChildPosts.Count > 0) { pm.ChildPosts = new List<PostModel>(); foreach(var cp in posts.ChildPosts) { pm.ChildPosts.Add(new PostModel() { PostText = cp.PostText, TimePosted = cp.TimePosted, UserName = cp.UserName }); } } gdm.GroupPosts.Add(pm); } } return View(gdm); }
public async Task<ActionResult> GroupDetail(GroupDetailModel model) { return View(model); }