// GET: /Create
        public ActionResult Create()
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }
            TripTypeRepository tripTypeRepository = new TripTypeRepository();
            SelectList         tripTypesList      = new SelectList(tripTypeRepository.GetAllTripTypes().ToList(), "TripTypeId", "TripTypeDescription");

            ViewData["TripTypes"] = tripTypesList;

            ExternalSystemParameterTypeRepository externalSystemParameterTypeRepository = new ExternalSystemParameterTypeRepository();
            SelectList externalSystemParameterTypeList = new SelectList(externalSystemParameterTypeRepository.GetAllExternalSystemParameterTypes().ToList(), "ExternalSystemParameterTypeId", "ExternalSystemParameterTypeName");

            ViewData["ExternalSystemParameterTypes"] = externalSystemParameterTypeList;

            TablesDomainHierarchyLevelRepository tablesDomainHierarchyLevelRepository = new TablesDomainHierarchyLevelRepository();
            SelectList hierarchyTypesList = new SelectList(tablesDomainHierarchyLevelRepository.GetDomainHierarchies(groupName).ToList(), "HierarchyLevelTableName", "HierarchyLevelTableName");

            ViewData["HierarchyTypes"] = hierarchyTypesList;

            ExternalSystemParameter group = new ExternalSystemParameter();

            return(View(group));
        }
        // GET: /Edit
        public ActionResult Edit(int id)
        {
            //Get Item From Database
            ExternalSystemParameter group = new ExternalSystemParameter();

            group = externalSystemParameterRepository.GetGroup(id);

            //Check Exists
            if (group == null)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("RecordDoesNotExistError"));
            }
            //Check Access
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToExternalSystemParameter(id))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }
            TripTypeRepository tripTypeRepository = new TripTypeRepository();
            SelectList         tripTypesList      = new SelectList(tripTypeRepository.GetAllTripTypes().ToList(), "TripTypeId", "TripTypeDescription");

            ViewData["TripTypes"] = tripTypesList;

            ExternalSystemParameterTypeRepository externalSystemParameterTypeRepository = new ExternalSystemParameterTypeRepository();
            SelectList externalSystemParameterTypeList = new SelectList(externalSystemParameterTypeRepository.GetAllExternalSystemParameterTypes().ToList(), "ExternalSystemParameterTypeId", "ExternalSystemParameterTypeName");

            ViewData["ExternalSystemParameterTypes"] = externalSystemParameterTypeList;

            TablesDomainHierarchyLevelRepository tablesDomainHierarchyLevelRepository = new TablesDomainHierarchyLevelRepository();
            SelectList hierarchyTypesList = new SelectList(tablesDomainHierarchyLevelRepository.GetDomainHierarchies(groupName).ToList(), "HierarchyLevelTableName", "HierarchyLevelTableName");

            ViewData["HierarchyTypes"] = hierarchyTypesList;

            externalSystemParameterRepository.EditGroupForDisplay(group);
            return(View(group));
        }