public ActionResult Create()
		{
			//Create Item 
			ClientTelephony clientTelephony = new ClientTelephony();

			//AccessRights
			RolesRepository rolesRepository = new RolesRepository();
			if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
			{
				ViewData["Message"] = "You do not have access to this item";
				return View("Error");
			}

			ClientTelephonyVM clientTelephonyVM = new ClientTelephonyVM();

			clientTelephonyVM.ClientTelephony = clientTelephony;
			
			//Countries
			clientTelephonyVM.Countries = new SelectList(countryRepository.GetAllCountries().ToList(), "CountryCode", "CountryNameWithInternationalPrefixCode");
			
			//HierarchyTypes
			clientTelephonyVM.HierarchyTypes = new SelectList(clientTelephonyRepository.GetAllHierarchyTypes().ToList(), "Value", "Text");

            //TelephoneTypes
            clientTelephonyVM.TelephoneTypes = new SelectList(telephonyTypeRepository.GetAllTelephonyTypes().ToList(), "TelephonyTypeId", "TelephonyTypeDescription");

            //TravelerBackOfficeTypes
            clientTelephonyVM.TravelerBackOfficeTypes = new SelectList(travelerBackOfficeTypeRepository.GetAllTravelerBackOfficeTypes().ToList(), "TravelerBackOfficeTypeCode", "TravelerBackOfficeTypeDescription");

            //CallerEnteredDigitDefinitionTypes
            CallerEnteredDigitDefinitionTypeRepository callerEnteredDigitDefinitionTypeRepository = new CallerEnteredDigitDefinitionTypeRepository();
            clientTelephonyVM.CallerEnteredDigitDefinitionTypes = new SelectList(callerEnteredDigitDefinitionTypeRepository.GetAllCallerEnteredDigitDefinitionTypes().ToList(), "CallerEnteredDigitDefinitionTypeId", "CallerEnteredDigitDefinitionTypeDescription");

            return View(clientTelephonyVM);
		}
		// GET: /Edit
		public ActionResult Edit(int id)
		{
			//Get Item 
			ClientTelephony clientTelephony = new ClientTelephony();
			clientTelephony = clientTelephonyRepository.GetClientTelephony(id);

			//Check Exists
			if (clientTelephony == null)
			{
				ViewData["ActionMethod"] = "EditGet";
				return View("RecordDoesNotExistError");
			}

			//AccessRights
			RolesRepository rolesRepository = new RolesRepository();
			if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
			{
				ViewData["Message"] = "You do not have access to this item";
				return View("Error");
			}

			ClientTelephonyVM clientTelephonyVM = new ClientTelephonyVM();

			clientTelephonyVM.ClientTelephony = clientTelephony;

			//Countries
			clientTelephonyVM.Countries = new SelectList(countryRepository.GetAllCountries().ToList(), "CountryCode", "CountryNameWithInternationalPrefixCode", clientTelephony.CountryCode);

			//HierarchyTypes
			clientTelephonyVM.HierarchyTypes = new SelectList(clientTelephonyRepository.GetAllHierarchyTypes().ToList(), "Value", "Text", clientTelephony.HierarchyType);

			//TelephoneTypes
			clientTelephonyVM.TelephoneTypes = new SelectList(telephonyTypeRepository.GetAllTelephonyTypes().ToList(), "TelephonyTypeId", "TelephonyTypeDescription", clientTelephony.TelephonyTypeId);

			//TravelerBackOfficeTypes
			clientTelephonyVM.TravelerBackOfficeTypes = new SelectList(travelerBackOfficeTypeRepository.GetAllTravelerBackOfficeTypes().ToList(), "TravelerBackOfficeTypeCode", "TravelerBackOfficeTypeDescription", clientTelephony.TravelerBackOfficeTypeCode);

            //CallerEnteredDigitDefinitionTypes
            CallerEnteredDigitDefinitionTypeRepository callerEnteredDigitDefinitionTypeRepository = new CallerEnteredDigitDefinitionTypeRepository();
            clientTelephonyVM.CallerEnteredDigitDefinitionTypes = new SelectList(callerEnteredDigitDefinitionTypeRepository.GetAllCallerEnteredDigitDefinitionTypes().ToList(), "CallerEnteredDigitDefinitionTypeId", "CallerEnteredDigitDefinitionTypeDescription", clientTelephony.CallerEnteredDigitDefinitionTypeId);

            clientTelephonyRepository.EditForDisplay(clientTelephony);

			return View(clientTelephonyVM);
		}
		public ActionResult Delete(ClientTelephonyVM clientTelephonyVM)
		{
			//Get Item 
			ClientTelephony clientTelephony = new ClientTelephony();
			clientTelephony = clientTelephonyRepository.GetClientTelephony(clientTelephonyVM.ClientTelephony.ClientTelephonyId);

			//Check Exists
			if (clientTelephonyVM.ClientTelephony == null)
			{
				ViewData["ActionMethod"] = "DeletePost";
				return View("RecordDoesNotExistError");
			}

			//Check Access Rights to Domain
			if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
			{
				ViewData["Message"] = "You do not have access to this item";
				return View("Error");
			}

			//Delete Item
			try
			{
				clientTelephonyRepository.Delete(clientTelephony);
			}
			catch (SqlException ex)
			{
				//Versioning Error - go to standard versionError page
				if (ex.Message == "SQLVersioningError")
				{
					ViewData["ReturnURL"] = "/ClientTelephony.mvc/Delete/" + clientTelephony.ClientTelephonyId;
					return View("VersionError");
				}

				//Generic Error
				ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details";
				return View("Error");
			}

			//Return
			return RedirectToAction("List");
		}
		public ActionResult Delete(int id)
		{
			ClientTelephonyVM clientTelephonyVM = new ClientTelephonyVM();

			ClientTelephony clientTelephony = new ClientTelephony();
			clientTelephony = clientTelephonyRepository.GetClientTelephony(id);

			//Check Exists
			if (clientTelephony == null)
			{
				ViewData["ActionMethod"] = "ViewGet";
				return View("RecordDoesNotExistError");
			}

			clientTelephonyVM.ClientTelephony = clientTelephony;

			clientTelephonyRepository.EditForDisplay(clientTelephony);

			return View(clientTelephonyVM);
		}