public ActionResult EditReferrals(int Id, int CaseheaderId) { viewDHSReferral viewDHSReferral; if (Id != 0) { viewDHSReferral = CMSService.GetDHSReferrals(Id); } else { viewDHSReferral = new viewDHSReferral(); viewDHSReferral.DateCreated = DateTime.Now; } viewDHSReferral.caselookup = getcaselookup(username, ViewBag.UserContractId); viewDHSReferral.viewCaseHeader = new AGE.CMS.Data.Models.Intake.viewCaseHeader(); viewDHSReferral.viewCaseHeader = CMSService.GetCaseHeaderById(CaseheaderId); viewDHSReferral.CaseheaderId = viewDHSReferral.viewCaseHeader.Id; if (viewDHSReferral.caselookup.listofcontracts != null && viewDHSReferral.caselookup.listofcontracts.Any() && viewDHSReferral.caselookup.listofcontracts.Count == 1) { viewDHSReferral.ContractId = viewDHSReferral.caselookup.listofcontracts.FirstOrDefault().Id; viewDHSReferral.ContractName = (from contract in viewDHSReferral.caselookup.listofcontracts where contract.Id == viewDHSReferral.ContractId select contract.ContractName).FirstOrDefault(); } return(View(viewDHSReferral)); }
public ActionResult ViewReferrals(int Id) { viewDHSReferral viewDHSReferral; if (Id != 0) { viewDHSReferral = CMSService.GetDHSReferrals(Id); viewDHSReferral.caselookup = getcaselookup(username, ViewBag.UserContractId); viewDHSReferral.viewCaseHeader = new AGE.CMS.Data.Models.Intake.viewCaseHeader(); viewDHSReferral.viewCaseHeader = CMSService.GetCaseHeaderById((int)viewDHSReferral.CaseheaderId); viewDHSReferral.CaseheaderId = viewDHSReferral.viewCaseHeader.Id; } else { viewDHSReferral = new viewDHSReferral(); viewDHSReferral.DateCreated = DateTime.Now; } var contractid = 0; if (viewDHSReferral != null) { contractid = viewDHSReferral.ContractId; } if (viewDHSReferral.caselookup.listofcontracts != null && viewDHSReferral.caselookup.listofcontracts.Any() && viewDHSReferral.caselookup.listofcontracts.Count == 1) { viewDHSReferral.ContractId = viewDHSReferral.caselookup.listofcontracts.FirstOrDefault().Id; viewDHSReferral.ContractName = (from contract in viewDHSReferral.caselookup.listofcontracts where contract.Id == viewDHSReferral.ContractId select contract.ContractName).FirstOrDefault(); } viewDHSReferral.caselookup = getcaselookup(username, ViewBag.UserContractId); viewDHSReferral.StatusDescription = CaseStatus.Opened.ToString(); CMSService.UpdateDHSReferralStatus(Id, viewDHSReferral.StatusDescription, username); viewDHSReferral.ContractAgencyName = CMSService.GetContract(contractid).DisplayContractName; return(View(viewDHSReferral)); }