示例#1
0
        private RedirectResult RedirectNext(NextSection next)
        {
            if (next.Type == NextType.Complete)
            {
                return(Redirect(BsgActions.Complete()));
            }

            if (next.Type == NextType.Ineligible)
            {
                return(Redirect(BsgActions.Ineligible(next.Id)));
            }

            var action = SectionActionStrategy.For(next.Section.Value).Action(next.Id);

            return(Redirect(action));
        }
示例#2
0
        public ActionResult Evidence(string id, Evidence evidence)
        {
            if (WasClicked(BsgButtons.UploadFile))
            {
                if (Request.Files.Count == 0)
                {
                    ModelState.AddModelError("", "Could not upload file");
                    return(Evidence_Render(id, evidence));
                }

                var file = Request.Files[0];

                if (string.IsNullOrWhiteSpace(file.FileName))
                {
                    ModelState.AddModelError("", "Please select a file to upload");
                    return(Evidence_Render(id, evidence));
                }

                const int maxSize = 1024 * 1024 * 2;

                if (file.ContentLength > maxSize)
                {
                    ModelState.AddModelError("", "Please select a file that is smaller than 2MB");
                    return(Evidence_Render(id, evidence));
                }

                using (var br = new BinaryReader(file.InputStream))
                {
                    var addFile = new AddEvidenceFile
                    {
                        FormId   = id,
                        Filename = file.FileName,
                        Content  = br.ReadBytes((int)file.InputStream.Length),
                    };

                    return(Exec(addFile,
                                success: () => Redirect(BsgActions.Evidence(id)),
                                failure: () => Evidence_Render(id, evidence)));
                }
            }
            else if (WasClicked(BsgButtons.RemoveFile))
            {
                var cloudName = Request.Form[BsgButtons.RemoveFile];

                var delFile = new RemoveEvidenceFile
                {
                    FormId    = id,
                    CloudName = cloudName,
                };

                return(Exec(delFile,
                            success: () => Redirect(BsgActions.Evidence(id)),
                            failure: () => Evidence_Render(id, evidence)));
            }

            var cmd = new AddEvidence
            {
                FormId   = id,
                Evidence = evidence,
            };

            return(Exec(cmd,
                        success: next => RedirectNext(next),
                        failure: () => Evidence_Render(id, evidence)));
        }
 public override string Action(string formId)
 {
     return(BsgActions.PartnerBenefits(formId));
 }
 public override string Action(string formId)
 {
     return(BsgActions.GuardianBenefits(formId));
 }
 public override string Action(string formId)
 {
     return(BsgActions.ExistingChildren(formId));
 }
 public override string Action(string formId)
 {
     return(BsgActions.ApplicantBenefits(formId));
 }
 public override string Action(string formId)
 {
     return(BsgActions.UKVerify(formId));
 }
 public override string Action(string formId)
 {
     return(BsgActions.ApplicantDetails(formId));
 }
 public override string Action(string formId)
 {
     return(BsgActions.Consent(formId));
 }
 public override string Action(string formId)
 {
     return(BsgActions.Declaration(formId));
 }
 public override string Action(string formId)
 {
     return(BsgActions.Evidence(formId));
 }
 public override string Action(string formId)
 {
     return(BsgActions.HealthProfessional(formId));
 }
 public override string Action(string formId)
 {
     return(BsgActions.GuardianPartnerDetails(formId));
 }