public ActionResult Group(ResponseGroupPostModel post) { var res = DnsResult.Catch(() => { var resps = ResponseService.GetVirtualResponses(post.RequestID, post.ResponseToken).ToList(); var rr = resps.SelectMany(r => r.Group == null ? new[] { r.SingleResponse } : r.Group.Responses); return (post.IsGroup ? ResponseService.GroupResponses(post.GroupName, rr).Merge(post.AlsoApprove ? ResponseService.ApproveResponses(rr) : DnsResult.Success) : post.IsUngroup ? resps.Where(r => r.Group != null).Select(r => ResponseService.UngroupResponses(r.Group)).Merge() : post.IsReject ? ResponseService.RejectResponses(resps.SelectMany(r => r.Group == null ? new[] { r.SingleResponse } : r.Group.Responses), post.RejectMessage) : post.IsApprove ? ResponseService.ApproveResponses(rr) : DnsResult.Failed("Unknown operation")); }); ModelState.Include(res); if (!ModelState.IsValid) { return(Detail(post.RequestID, post.ResponseToken, post.AggregationMode)); } return(RedirectToAction <RequestController>(c => c.RequestView(post.RequestID, null))); }