// GET: mem_site_visit public IActionResult Index(string memberId, string v) { List <ViewModels.mem_site_visit.mem_site_visitViewModel> mem_site_visitViewModels = new List <ViewModels.mem_site_visit.mem_site_visitViewModel>(); var member = _context.member.Single(m => m.id == new Guid(memberId)); var mem_site_visits = _context.mem_site_visit.Where(m => m.member_code == member.member_code).OrderBy(m => m.rec_no).ToList(); foreach (var msv in mem_site_visits) { var mem_site_visitViewModel = new ViewModels.mem_site_visit.mem_site_visitViewModel(); mem_site_visitViewModel.mem_site_visit = msv; mem_site_visitViewModel.country_desc = _context.ini_country.Single(i => i.country_code == msv.country_code).country_desc; mem_site_visitViewModels.Add(mem_site_visitViewModel); } ViewBag.memberId = memberId; if (!String.IsNullOrEmpty(v)) { ViewBag.isViewOnly = 1; } else { ViewBag.isViewOnly = 0; } ViewBag.country_code = new SelectList(_context.ini_country, "country_code", "country_desc"); return(View(mem_site_visitViewModels)); }
// GET: mem_site_visit public IActionResult Index(string memberId) { List<ViewModels.mem_site_visit.mem_site_visitViewModel> mem_site_visitViewModels = new List<ViewModels.mem_site_visit.mem_site_visitViewModel>(); var member = _context.member.Single(m => m.id == new Guid(memberId)); var mem_site_visits = _context.mem_site_visit.Where(m => m.member_code == member.member_code).OrderBy(m => m.rec_no).ToList(); foreach (var msv in mem_site_visits) { var mem_site_visitViewModel = new ViewModels.mem_site_visit.mem_site_visitViewModel(); mem_site_visitViewModel.mem_site_visit = msv; mem_site_visitViewModel.country_desc = _context.ini_country.Single(i => i.country_code == msv.country_code).country_desc; mem_site_visitViewModels.Add(mem_site_visitViewModel); } ViewBag.memberId = memberId; ViewBag.country_code = new SelectList(_context.ini_country, "country_code", "country_desc"); return View(mem_site_visitViewModels); }