//GET:List
        public ActionResult List(int id, int?page, string sortField, int?sortOrder)
        {
            //Get ReasonCodeItem
            ReasonCodeItem reasonCodeItem = new ReasonCodeItem();

            reasonCodeItem = reasonCodeItemRepository.GetItem(id);


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

            //Set Access Rights
            ViewData["Access"] = "";
            RolesRepository rolesRepository = new RolesRepository();

            if (rolesRepository.HasWriteAccessToReasonCodeGroup(reasonCodeItem.ReasonCodeGroupId))
            {
                ViewData["Access"] = "WriteAccess";
            }

            //Parent Information
            reasonCodeItemRepository.EditItemForDisplay(reasonCodeItem);
            ViewData["ReasonCodeItem"]      = reasonCodeItem.ReasonCode + "/" + reasonCodeItem.ReasonCodeTypeDescription + "/" + reasonCodeItem.ProductName;
            ViewData["ReasonCodeItemId"]    = reasonCodeItem.ReasonCodeItemId;
            ViewData["ReasonCodeGroupId"]   = reasonCodeItem.ReasonCodeGroupId;
            ViewData["ReasonCodeGroupName"] = reasonCodeGroupRepository.GetGroup(reasonCodeItem.ReasonCodeGroupId).ReasonCodeGroupName;
            ViewData["DisplayOrder"]        = reasonCodeItem.DisplayOrder;

            //SortField+SortOrder settings
            if (sortField != "ReasonCodeAlternativeDescription")
            {
                sortField = "LanguageName";
            }
            ViewData["CurrentSortField"] = sortField;

            if (sortOrder == 1)
            {
                ViewData["NewSortOrder"]     = 0;
                ViewData["CurrentSortOrder"] = 1;
            }
            else
            {
                ViewData["NewSortOrder"]     = 1;
                ViewData["CurrentSortOrder"] = 0;
            }

            //Get data
            var paginatedView = reasonCodeAlternativeDescriptionRepository.GetAlternativeDescriptions(id, page ?? 1, sortField, sortOrder ?? 0);

            //Return View
            return(View(paginatedView));
        }
        // GET: /Edit
        public ActionResult Edit(int id)
        {
            //Get Item
            ReasonCodeItem reasonCodeItem = new ReasonCodeItem();

            reasonCodeItem = reasonCodeItemRepository.GetItem(id);

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

            //Check AccessRights
            RolesRepository rolesRepository = new RolesRepository();

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

            ReasonCodeProductTypeRepository reasonCodeProductTypeRepository = new ReasonCodeProductTypeRepository();
            SelectList reasonCodeList = new SelectList(reasonCodeProductTypeRepository.GetAllReasonCodeProductTypes().ToList(), "ReasonCodeValue", "ReasonCodeValue");

            ViewData["ReasonCodes"] = reasonCodeList;

            SelectList productList = new SelectList(reasonCodeProductTypeRepository.LookUpReasonCodeProducts(reasonCodeItem.ReasonCode).ToList(), "ProductId", "ProductName");

            ViewData["Products"] = productList;

            SelectList reasonCodeTypeList = new SelectList(reasonCodeProductTypeRepository.LookUpAvailableReasonCodeProductReasonCodeTypes(
                                                               reasonCodeItem.ReasonCodeItemId,
                                                               reasonCodeItem.ReasonCodeGroupId,
                                                               reasonCodeItem.ReasonCode,
                                                               reasonCodeItem.ProductId).ToList(), "ReasonCodeTypeId", "ReasonCodeTypeDescription");

            ViewData["ReasonCodeTypes"] = reasonCodeTypeList;

            //Parent Information
            reasonCodeItemRepository.EditItemForDisplay(reasonCodeItem);
            ViewData["ReasonCodeItem"]      = reasonCodeItem.ReasonCode + "/" + reasonCodeItem.ReasonCodeTypeDescription + "/" + reasonCodeItem.ProductName;
            ViewData["ReasonCodeItemId"]    = reasonCodeItem.ReasonCodeItemId;
            ViewData["ReasonCodeGroupId"]   = reasonCodeItem.ReasonCodeGroupId;
            ViewData["ReasonCodeGroupName"] = reasonCodeGroupRepository.GetGroup(reasonCodeItem.ReasonCodeGroupId).ReasonCodeGroupName;

            reasonCodeItemRepository.EditItemForDisplay(reasonCodeItem);
            return(View(reasonCodeItem));
        }