public async Task <IActionResult> Edit(int id, [Bind("ScaScreenId,ClientServiceId,wsclinic,referralsource,whyfamilyseen,treatmenthistory,asddiagnosis,halfwayshelter,recentlymove,outsidevbh,meetcriteria,referraldetails,shelterdetails,wasstatenotified,gennote,privateinsurer,privateinsurance,managedcaretype,requestedlocation,servicerequested,currentcounty")] ScaScreen scaScreen) { if (id != scaScreen.ScaScreenId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(scaScreen); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ScaScreenExists(scaScreen.ScaScreenId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ClientServiceId"] = new SelectList(_context.ClientServices, "ClientServiceId", "ClientServiceId", scaScreen.ClientServiceId); return(View(scaScreen)); }
public async Task <IActionResult> Create([Bind("ScaScreenId,ClientServiceId,wsclinic,referralsource,whyfamilyseen,treatmenthistory,asddiagnosis,halfwayshelter,recentlymove,outsidevbh,meetcriteria,referraldetails,shelterdetails,wasstatenotified,gennote,privateinsurer,privateinsurance,managedcaretype,requestedlocation,servicerequested,currentcounty")] ScaScreen scaScreen) { if (ModelState.IsValid) { _context.Add(scaScreen); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ClientServiceId"] = new SelectList(_context.ClientServices, "ClientServiceId", "ClientServiceId", scaScreen.ClientServiceId); return(View(scaScreen)); }
public async Task <IActionResult> Create(InquiryFormViewModel inquiryFormViewModel) { ClientService cs = inquiryFormViewModel.Inquiry; Clineitem ci = inquiryFormViewModel.Note; ScaScreen sca = inquiryFormViewModel.ScaScreen; Client client = inquiryFormViewModel.Client; if (ModelState.IsValid) { int clientId = (int)cs.ClientId; client.ClientId = clientId; _context.Update(client); await _context.SaveChangesAsync(); _context.Add(cs); await _context.SaveChangesAsync(); ci.ClientServiceId = cs.ClientServiceId; _context.Add(ci); await _context.SaveChangesAsync(); sca.ClientServiceId = cs.ClientServiceId; _context.Update(sca); await _context.SaveChangesAsync(); TempData["Alert"] = "Created Inquiry"; return(RedirectToAction("Edit", "ClientServices", new { id = cs.ClientServiceId })); } ViewData["ClientId"] = new SelectList(_context.Clients.OrderBy(m => m.name), "ClientId", "name", cs.ClientId); ViewData["ServiceId"] = new SelectList(_context.Services.OrderBy(m => m.service_desc), "ServiceId", "service_desc", cs.ServiceId); ViewData["ZcaresreasonId"] = new SelectList(_context.Zcaresreason.OrderBy(m => m.caresreason), "ZcaresreasonId", "caresreason", cs.ZcaresreasonId); ViewData["ZhearaboutId"] = new SelectList(_context.Zhearabout.OrderBy(m => m.hearabout), "ZhearaboutId", "hearabout", cs.ZhearaboutId); ViewData["ZinternalId"] = new SelectList(_context.Zinternal.Where(m => m.active).OrderBy(m => m.internal_type), "ZinternalId", "internal_type", cs.ZinternalId); ViewData["ZinternalcategoryId"] = new SelectList(_context.Zinternalcategory.OrderBy(m => m.internalsubcat), "ZinternalcategoryId", "internalsubcat", cs.ZinternalcategoryId); ViewData["ZlocationId"] = new SelectList(_context.Zlocation.OrderBy(m => m.location), "ZlocationId", "location", cs.ZlocationId); ViewData["ZopotherId"] = new SelectList(_context.Zopother.OrderBy(m => m.opother), "ZopotherId", "opother", cs.ZopotherId); ViewData["ZplatformId"] = new SelectList(_context.Zplatform.OrderBy(m => m.opplatform), "ZplatformId", "opplatform", cs.ZplatformId); ViewData["ZprogramsId"] = new SelectList(_context.Zprograms.Where(m => m.active).OrderBy(m => m.program_desc), "ZprogramsId", "program_desc", cs.ZprogramsId); ViewData["ZreasonId"] = new SelectList(_context.Zreason.Where(m => m.active).OrderBy(m => m.final_reason), "ZreasonId", "final_reason", cs.ZreasonId); ViewData["ZresourcereasonId"] = new SelectList(_context.Zresourcereason.OrderBy(m => m.resourceresult), "ZresourcereasonId", "resourceresult", cs.ZresourcereasonId); ViewData["ZschoolId"] = new SelectList(_context.Zschool.Where(m => m.active).OrderBy(m => m.displayname), "ZschoolId", "displayname", cs.ZschoolId); ViewData["ZsiteId"] = new SelectList(_context.Zsite.Where(m => m.active).OrderBy(m => m.site), "ZsiteId", "site", cs.ZsiteId); ViewData["ZstatusId"] = new SelectList(_context.Zstatus.Where(m => m.active).OrderBy(m => m.inq_status), "ZstatusId", "inq_status", cs.ZstatusId); ViewData["ZworkerId"] = new SelectList(_context.Zworker.Where(m => m.active).OrderBy(m => m.worker), "ZworkerId", "worker", cs.ZworkerId); return(View(inquiryFormViewModel)); }
public async Task <IActionResult> Edit(int id, InquiryDetailsViewModel inquiryDetailsViewModel) { ClientService cs = inquiryDetailsViewModel.Inquiry; ScaScreen sca = inquiryDetailsViewModel.ScaScreen; Client client = inquiryDetailsViewModel.Client; int scaId = inquiryDetailsViewModel.ScaId; if (id != cs.ClientServiceId) { return(NotFound()); } if (ModelState.IsValid) { try { client.ClientId = (int)cs.ClientId; _context.Update(client); await _context.SaveChangesAsync(); _context.Update(cs); await _context.SaveChangesAsync(); sca.ClientServiceId = cs.ClientServiceId; if (scaId == 0) { _context.Add(sca); } else { sca.ScaScreenId = scaId; _context.Update(sca); } TempData["Alert"] = "Saved Changes to Inquiry"; await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClientServiceExists(cs.ClientServiceId)) { return(NotFound()); } else { throw; } } /*modified following line from Details to Edit*/ return(RedirectToAction("Edit", "ClientServices", new { id = cs.ClientServiceId })); } ViewData["ClientId"] = new SelectList(_context.Clients.OrderBy(m => m.name), "ClientId", "name", cs.ClientId); ViewData["ServiceId"] = new SelectList(_context.Services.OrderBy(m => m.service_desc), "ServiceId", "service_desc", cs.ServiceId); ViewData["ZcaresreasonId"] = new SelectList(_context.Zcaresreason.OrderBy(m => m.caresreason), "ZcaresreasonId", "caresreason", cs.ZcaresreasonId); ViewData["ZhearaboutId"] = new SelectList(_context.Zhearabout.OrderBy(m => m.hearabout), "ZhearaboutId", "hearabout", cs.ZhearaboutId); ViewData["ZinternalId"] = new SelectList(_context.Zinternal.Where(m => m.active).OrderBy(m => m.internal_type), "ZinternalId", "internal_type", cs.ZinternalId); ViewData["ZinternalcategoryId"] = new SelectList(_context.Zinternalcategory.OrderBy(m => m.internalsubcat), "ZinternalcategoryId", "internalsubcat", cs.ZinternalcategoryId); ViewData["ZlocationId"] = new SelectList(_context.Zlocation.OrderBy(m => m.location), "ZlocationId", "location", cs.ZlocationId); ViewData["ZopotherId"] = new SelectList(_context.Zopother.OrderBy(m => m.opother), "ZopotherId", "opother", cs.ZopotherId); ViewData["ZplatformId"] = new SelectList(_context.Zplatform.OrderBy(m => m.opplatform), "ZplatformId", "opplatform", cs.ZplatformId); ViewData["ZprogramsId"] = new SelectList(_context.Zprograms.Where(m => m.active).OrderBy(m => m.program_desc), "ZprogramsId", "program_desc", cs.ZprogramsId); ViewData["ZreasonId"] = new SelectList(_context.Zreason.OrderBy(m => m.final_reason), "ZreasonId", "final_reason", cs.ZreasonId); ViewData["ZresourcereasonId"] = new SelectList(_context.Zresourcereason.OrderBy(m => m.resourceresult), "ZresourcereasonId", "resourceresult", cs.ZresourcereasonId); ViewData["ZschoolId"] = new SelectList(_context.Zschool.Where(m => m.active).OrderBy(m => m.displayname), "ZschoolId", "displayname", cs.ZschoolId); ViewData["ZsiteId"] = new SelectList(_context.Zsite.Where(m => m.active).OrderBy(m => m.site), "ZsiteId", "site", cs.ZsiteId); ViewData["ZstatusId"] = new SelectList(_context.Zstatus.Where(m => m.active).OrderBy(m => m.inq_status), "ZstatusId", "inq_status", cs.ZstatusId); ViewData["ZworkerId"] = new SelectList(_context.Zworker.Where(m => m.active).OrderBy(m => m.worker), "ZworkerId", "worker", cs.ZworkerId); ViewData["ZcountyId"] = new SelectList(_context.Zcounty.OrderBy(m => m.county), "ZcountyId", "county", client.ZcountyId); ViewData["ZraceId"] = new SelectList(_context.Zrace.OrderBy(m => m.race), "ZraceId", "race", client.ZraceId); ViewData["ZinsuranceId"] = new SelectList(_context.Zinsurance.Where(m => m.active).OrderBy(m => m.insurance), "ZinsuranceId", "insurance", client.ZinsuranceId); return(View(inquiryDetailsViewModel)); }