public ActionResult AppRecToDgh(string appid) { //ViewBag.Title = "Submit Proposal"; DGHERProposalViewModel viewModel = new DGHERProposalViewModel(); if (!string.IsNullOrEmpty(appid)) { ERApplication erapp = ERApplicationContext.Collection().Where(x => x.AppId == appid).FirstOrDefault(); viewModel.ERApplications = erapp; if (!string.IsNullOrEmpty(erapp.ERScreeningDetailId)) { ViewBag.ERFiles = UploadFileContext.Collection() .Where(y => y.FIleRef == erapp.ERScreeningDetail.ReportDocumentPath).ToList(); } else { ViewBag.ERFiles = null; } viewModel.FieldTypes = FieldTypeContext.Collection(); viewModel.UHCProductionMethods = UHCProductionMethodContext.Collection(); viewModel.comment = CommentContext.Collection().Where(x => x.ERApplicationId == erapp.Id); return(View(viewModel)); } else { return(RedirectToAction("Index")); //viewModel.ERApplications = new ERApplication(); } //viewModel.UploadFiles = UploadFileContext.Collection(); }
public ActionResult SubmitERProposal(string appid) { string[] userdata = Session["UserData"] as string[]; string userid = userdata[0]; ViewBag.Title = "Submit Proposal"; ViewBag.RefId = Guid.NewGuid().ToString(); OperatorERProposalViewModel viewModel = new OperatorERProposalViewModel(); if (!string.IsNullOrEmpty(appid)) { ERApplication erapp = ERApplicationContext.Collection().Where(x => x.AppId == appid).FirstOrDefault(); viewModel.ERApplications = erapp; if (!string.IsNullOrEmpty(erapp.ERScreeningDetailId)) { ViewBag.ERFiles = UploadFileContext.Collection() .Where(y => y.FIleRef == erapp.ERScreeningDetail.ReportDocumentPath).ToList(); } else { ViewBag.ERFiles = null; } } else { viewModel.ERApplications = new ERApplication(); viewModel.ERApplications.Organisation = UserAccountContext.Collection().Where(x => x.Id == userid).FirstOrDefault().Organisation; viewModel.ERApplications.OrganisationId = viewModel.ERApplications.Organisation.Id; } viewModel.FieldTypes = FieldTypeContext.Collection().ToList(); viewModel.UHCProductionMethods = UHCProductionMethodContext.Collection().ToList(); viewModel.eRTechniques = ERTechniquesContext.Collection().ToList(); viewModel.eRScreeningInstitutes = ERScreeningInstituteContext.Collection().ToList(); //viewModel.UploadFiles = UploadFileContext.Collection(); return(View(viewModel)); }