public ActionResult Create() { //Create Item TravelPort travelPort = new TravelPort(); //AccessRights RolesRepository rolesRepository = new RolesRepository(); if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //StateProvince SelectList SelectList stateProvinceList = new SelectList(stateProvinceRepository.GetStateProvincesByCountryCode(travelPort.CountryCode).ToList(), "StateProvinceCode", "Name"); ViewData["StateProvinceList"] = stateProvinceList; //TravelPort SelectList SelectList travelPortTypeList = new SelectList(travelPortTypeRepository.GetAllTravelPortTypes().ToList(), "TravelPortTypeId", "TravelPortTypeDescription"); ViewData["TravelPortTypeList"] = travelPortTypeList; return(View(travelPort)); }
public ActionResult Delete(int id) { //Set Access Rights ViewData["Access"] = ""; if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } PolicyLocation policyLocation = new PolicyLocation(); policyLocation = policyLocationRepository.GetPolicyLocation(id); if (policyLocation == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } TravelPortTypeRepository travelPortTypeRepository = new TravelPortTypeRepository(); SelectList travelPortTypes = new SelectList(travelPortTypeRepository.GetAllTravelPortTypes().ToList(), "TravelPortTypeId", "TravelPortTypeDescription"); ViewData["TravelPortTypeList"] = travelPortTypes; policyLocationRepository.EditForDisplay(policyLocation); return(View(policyLocation)); }
// GET: /Create public ActionResult Create(string id) { //Get Parent TravelPort travelPort = new TravelPort(); travelPort = travelPortRepository.GetTravelPort(id); //Check Exists if (travelPort == null) { ViewData["ActionMethod"] = "CreateGet"; return(View("RecordDoesNotExistError")); } //AccessRights HierarchyRepository hierarchyRepository = new HierarchyRepository(); if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //New TravelPortLanguage TravelPortLanguage travelPortLanguage = new TravelPortLanguage(); travelPortLanguage.TravelPortCode = id; travelPortLanguageRepository.EditForDisplay(travelPortLanguage); //Populate List of Languages LanguageRepository languageRepository = new LanguageRepository(); SelectList languages = new SelectList(languageRepository.GetAllLanguages().ToList(), "LanguageCode", "LanguageName"); ViewData["LanguageList"] = languages; //Populate List of Languages TravelPortTypeRepository travelPortTypeRepository = new TravelPortTypeRepository(); SelectList travelPortTypes = new SelectList(travelPortTypeRepository.GetAllTravelPortTypes().ToList(), "TravelPortTypeId", "TravelPortTypeDescription"); ViewData["TravelPortTypeList"] = travelPortTypes; //Show Create Form return(View(travelPortLanguage)); }
// GET: /Create public ActionResult Create() { //Set Access Rights ViewData["Access"] = ""; if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } TravelPortTypeRepository travelPortTypeRepository = new TravelPortTypeRepository(); SelectList travelPortTypes = new SelectList(travelPortTypeRepository.GetAllTravelPortTypes().ToList(), "TravelPortTypeId", "TravelPortTypeDescription"); ViewData["TravelPortTypeList"] = travelPortTypes; PolicyLocation policyLocation = new PolicyLocation(); return(View(policyLocation)); }
// GET: /Edit public ActionResult View(int id) { PolicyLocation policyLocation = new PolicyLocation(); policyLocation = policyLocationRepository.GetPolicyLocation(id); if (policyLocation == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } TravelPortTypeRepository travelPortTypeRepository = new TravelPortTypeRepository(); SelectList travelPortTypes = new SelectList(travelPortTypeRepository.GetAllTravelPortTypes().ToList(), "TravelPortTypeId", "TravelPortTypeDescription"); ViewData["TravelPortTypeList"] = travelPortTypes; policyLocationRepository.EditForDisplay(policyLocation); return(View(policyLocation)); }