// GET: /List public ActionResult List(string csu, string tt, int id, int?page) { ClientDetailTravelerType clientDetailTravelerType = new ClientDetailTravelerType(); clientDetailTravelerType = clientDetailTravelerTypeRepository.GetClientDetailTravelerType(id); //Check Exists if (clientDetailTravelerType == null) { ViewData["ActionMethod"] = "List"; return(View("RecordDoesNotExistError")); } ClientSubUnitTravelerType clientSubUnitTravelerType = new ClientSubUnitTravelerType(); clientSubUnitTravelerType = clientSubUnitTravelerTypeRepository.GetClientSubUnitTravelerType(csu, tt); //Check Exists if (clientDetailTravelerType == null) { ViewData["ActionMethod"] = "List"; return(View("RecordDoesNotExistError")); } //Access Rights ViewData["Access"] = ""; RolesRepository rolesRepository = new RolesRepository(); if (rolesRepository.HasWriteAccessToClientSubUnit(csu)) { ViewData["Access"] = "WriteAccess"; } //Populate View Model TravelerTypeAddressesVM travelerTypeAddressesVM = new TravelerTypeAddressesVM(); travelerTypeAddressesVM.Addresses = clientDetailRepository.ListClientDetailAddresses(id, page ?? 1); ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu); travelerTypeAddressesVM.ClientSubUnit = clientSubUnit; ClientDetail clientDetail = new ClientDetail(); clientDetail = clientDetailRepository.GetGroup(id); travelerTypeAddressesVM.ClientDetail = clientDetail; TravelerType travelerType = new TravelerType(); travelerType = travelerTypeRepository.GetTravelerType(tt); travelerTypeAddressesVM.TravelerType = travelerType; return(View(travelerTypeAddressesVM)); }
// GET: /List public ActionResult List(int id, int?page) { ClientDetail clientDetail = new ClientDetail(); clientDetail = clientDetailRepository.GetGroup(id); //Check Exists if (clientDetail == null) { ViewData["ActionMethod"] = "ListSubMenu"; return(View("RecordDoesNotExistError")); } ClientDetailClientAccount clientDetailClientAccount = new ClientDetailClientAccount(); clientDetailClientAccount = clientDetailClientAccountRepository.GetClientDetailClientAccount(id); //Check Exists if (clientDetailClientAccount == null) { ViewData["ActionMethod"] = "ListSubMenu"; return(View("RecordDoesNotExistError")); } string can = clientDetailClientAccount.ClientAccountNumber; string ssc = clientDetailClientAccount.SourceSystemCode; ClientAccount clientAccount = new ClientAccount(); clientAccount = clientAccountRepository.GetClientAccount(can, ssc); //Access Rights ViewData["Access"] = ""; RolesRepository rolesRepository = new RolesRepository(); if (rolesRepository.HasWriteAccessToClientAccount(can, ssc)) { ViewData["Access"] = "WriteAccess"; } //Populate View Model ClientAccountAddressesVM clientDetailAddressesVM = new ClientAccountAddressesVM(); clientDetailAddressesVM.Addresses = clientDetailRepository.ListClientDetailAddresses(id, page ?? 1); clientDetailAddressesVM.ClientAccount = clientAccount; clientDetailAddressesVM.ClientDetail = clientDetail; return(View(clientDetailAddressesVM)); }