public async Task <ActionResult> FileReview(int?id, ReviewFileModel model)
        {
            var form = await this.applicationFormManager.FindByIdAsync(model.FormId);

            if (form == null)
            {
                return(View("NoPendingFileReview"));
            }

            try
            {
                await this.applicationFormManager.FileReviewAsync(form, model.Accepted, this.DomainUser().DisplayName, model.FileReviewMessage);

                if (!model.Accepted)
                {
                    //退回报名表。
                    if (model.ReturnBackToUserIfRefused)
                    {
                        await this.applicationFormManager.ReturnBackAsync(form);
                    }
                }
            }
            catch (FileReviewException)
            {
                //审查异常,表明可能已经被审查。
                //DoNothing here.
            }
            catch (Exception ex)
            {
                this.ModelState.AddModelError("", ex.Message);
                return(View(model));
            }
            if (model.Next)
            {
                return(RedirectToAction("FileReview", routeValues: null));
            }

            return(View("FileReviewComplete"));
        }
        public ActionResult FileReview(int?id)
        {
            ApplicationForm form;

            if (id.HasValue)
            {
                form = this.applicationFormManager.ApplicationForms.PendingFileReview().FirstOrDefault(a => a.Id == id.Value);
                if (form == null)
                {
                    return(HttpNotFound());
                }
            }
            else
            {
                var forms        = this.applicationFormManager.ApplicationForms.PendingFileReview().OrderBy(a => a.WhenCommited);
                var pendingCount = forms.Count();
                if (pendingCount == 0)
                {
                    return(View("NoPendingFileReview"));
                }
                if (pendingCount > 10)
                {
                    pendingCount = 10;
                }
                form = forms.Skip(new Random().Next(pendingCount)).FirstOrDefault();
            }

            if (form == null)
            {
                return(View("NoPendingFileReview"));
            }

            var model = new ReviewFileModel
            {
                FormId = form.Id,
            };

            return(View(model));
        }