// GET: /Create
        public ActionResult Create()
        {
            //AccessRights
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToReferenceInfo())
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            ControlPropertyRepository controlPropertyRepository = new ControlPropertyRepository();
            SelectList controlPropertyList = new SelectList(controlPropertyRepository.GetAllControlProperties().ToList(), "ControlPropertyId", "ControlPropertyDescription");

            ViewData["ControlProperties"] = controlPropertyList;

            ControlNameRepository controlNameRepository = new ControlNameRepository();
            SelectList            controlNameList       = new SelectList(controlNameRepository.GetAllControlNames().ToList(), "ControlNameId", "ControlName1");

            ViewData["ControlNames"] = controlNameList;

            ControlValue controlValue = new ControlValue();

            return(View(controlValue));
        }
        // GET: /Edit
        public ActionResult Edit(int id)
        {
            //Check Exists
            ControlValue controlValue = new ControlValue();

            controlValue = controlValueRepository.GetControlValue(id);
            if (controlValue == null)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("RecordDoesNotExistError"));
            }
            //AccessRights
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToReferenceInfo())
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            ControlPropertyRepository controlPropertyRepository = new ControlPropertyRepository();
            SelectList controlPropertyList = new SelectList(controlPropertyRepository.GetAllControlProperties().ToList(), "ControlPropertyId", "ControlPropertyDescription");

            ViewData["ControlProperties"] = controlPropertyList;

            ControlNameRepository controlNameRepository = new ControlNameRepository();
            SelectList            controlNameList       = new SelectList(controlNameRepository.GetAllControlNames().ToList(), "ControlNameId", "ControlName1");

            ViewData["ControlNames"] = controlNameList;

            return(View(controlValue));
        }