public ActionResult Delete(int id, string languageCode)
        {
            //Get Item
            PolicyAirMissedSavingsThresholdGroupItemLanguage policyAirMissedSavingsThresholdGroupItemLanguage = new PolicyAirMissedSavingsThresholdGroupItemLanguage();

            policyAirMissedSavingsThresholdGroupItemLanguage = policyAirMissedSavingsThresholdGroupItemLanguageRepository.GetItem(id, languageCode);

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

            //Check AccessRights
            PolicyAirMissedSavingsThresholdGroupItem policyAirMissedSavingsThresholdGroupItem = new PolicyAirMissedSavingsThresholdGroupItem();

            policyAirMissedSavingsThresholdGroupItem = policyAirMissedSavingsThresholdGroupItemRepository.GetPolicyAirMissedSavingsThresholdGroupItem(id);
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToPolicyGroup(policyAirMissedSavingsThresholdGroupItem.PolicyGroupId))
            {
                return(View("Error"));
            }

            //Add Linked Information
            policyAirMissedSavingsThresholdGroupItemLanguageRepository.EditItemForDisplay(policyAirMissedSavingsThresholdGroupItemLanguage);

            //Return View
            return(View(policyAirMissedSavingsThresholdGroupItemLanguage));
        }
Exemple #2
0
        public ActionResult Delete(int id)
        {
            PolicyAirMissedSavingsThresholdGroupItem policyAirMissedSavingsThresholdGroupItem = new PolicyAirMissedSavingsThresholdGroupItem();

            policyAirMissedSavingsThresholdGroupItem = policyAirMissedSavingsThresholdGroupItemRepository.GetPolicyAirMissedSavingsThresholdGroupItem(id);

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

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

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

            //Create ViewModel
            PolicyAirMissedSavingsThresholdGroupItemVM policyAirMissedSavingsThresholdGroupItemVM = new PolicyAirMissedSavingsThresholdGroupItemVM();

            PolicyGroup policyGroup = new PolicyGroup();

            policyGroup = policyGroupRepository.GetGroup(policyAirMissedSavingsThresholdGroupItem.PolicyGroupId);
            policyAirMissedSavingsThresholdGroupItemVM.PolicyGroup = policyGroup;

            policyAirMissedSavingsThresholdGroupItemVM.PolicyAirMissedSavingsThresholdGroupItem = policyAirMissedSavingsThresholdGroupItem;

            //Return Form to Users
            return(View(policyAirMissedSavingsThresholdGroupItemVM));
        }
        // GET: /Edit
        public ActionResult Edit(int id, string languageCode)
        {
            //Get Item
            PolicyAirMissedSavingsThresholdGroupItemLanguage policyAirMissedSavingsThresholdGroupItemLanguage = new PolicyAirMissedSavingsThresholdGroupItemLanguage();

            policyAirMissedSavingsThresholdGroupItemLanguage = policyAirMissedSavingsThresholdGroupItemLanguageRepository.GetItem(id, languageCode);

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

            //Check AccessRights
            PolicyAirMissedSavingsThresholdGroupItem policyAirMissedSavingsThresholdGroupItem = new PolicyAirMissedSavingsThresholdGroupItem();

            policyAirMissedSavingsThresholdGroupItem = policyAirMissedSavingsThresholdGroupItemRepository.GetPolicyAirMissedSavingsThresholdGroupItem(id);
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToPolicyGroup(policyAirMissedSavingsThresholdGroupItem.PolicyGroupId))
            {
                return(View("Error"));
            }

            //Language SelectList
            SelectList languageList = new SelectList(policyAirMissedSavingsThresholdGroupItemLanguageRepository.GetUnUsedLanguages(id).ToList(), "LanguageCode", "LanguageName");

            ViewData["Languages"] = languageList;

            policyAirMissedSavingsThresholdGroupItemLanguageRepository.EditItemForDisplay(policyAirMissedSavingsThresholdGroupItemLanguage);
            return(View(policyAirMissedSavingsThresholdGroupItemLanguage));
        }
Exemple #4
0
        //Add Data From Linked Tables for Display
        public void EditItemForDisplay(PolicyAirMissedSavingsThresholdGroupItemLanguage policyAirMissedSavingsThresholdGroupItemLanguage)
        {
            //Add LanguageName
            if (policyAirMissedSavingsThresholdGroupItemLanguage.LanguageCode != null)
            {
                LanguageRepository languageRepository = new LanguageRepository();
                Language           language           = new Language();
                language = languageRepository.GetLanguage(policyAirMissedSavingsThresholdGroupItemLanguage.LanguageCode);
                if (language != null)
                {
                    policyAirMissedSavingsThresholdGroupItemLanguage.LanguageName = language.LanguageName;
                }
            }

            //Add PolicyGroupName
            PolicyAirMissedSavingsThresholdGroupItemRepository policyAirMissedSavingsThresholdGroupItemRepository = new PolicyAirMissedSavingsThresholdGroupItemRepository();
            PolicyAirMissedSavingsThresholdGroupItem           policyAirMissedSavingsThresholdGroupItem           = new PolicyAirMissedSavingsThresholdGroupItem();

            policyAirMissedSavingsThresholdGroupItem = policyAirMissedSavingsThresholdGroupItemRepository.GetPolicyAirMissedSavingsThresholdGroupItem(policyAirMissedSavingsThresholdGroupItemLanguage.PolicyAirMissedSavingsThresholdGroupItemId);


            if (policyAirMissedSavingsThresholdGroupItem != null)
            {
                PolicyGroupRepository policyGroupRepository = new PolicyGroupRepository();
                PolicyGroup           policyGroup           = new PolicyGroup();
                policyGroup = policyGroupRepository.GetGroup(policyAirMissedSavingsThresholdGroupItem.PolicyGroupId);

                //policyAirMissedSavingsThresholdGroupItemRepository.EditItemForDisplay(policyAirMissedSavingsThresholdGroupItem);
                policyAirMissedSavingsThresholdGroupItemLanguage.PolicyGroupName = policyGroup.PolicyGroupName;
                policyAirMissedSavingsThresholdGroupItemLanguage.PolicyGroupId   = policyAirMissedSavingsThresholdGroupItem.PolicyGroupId;
            }
        }
Exemple #5
0
        // GET: /View
        public ActionResult View(int id)
        {
            PolicyAirMissedSavingsThresholdGroupItem policyAirMissedSavingsThresholdGroupItem = new PolicyAirMissedSavingsThresholdGroupItem();

            policyAirMissedSavingsThresholdGroupItem = policyAirMissedSavingsThresholdGroupItemRepository.GetPolicyAirMissedSavingsThresholdGroupItem(id);

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

            //Create ViewModel
            PolicyAirMissedSavingsThresholdGroupItemVM policyAirMissedSavingsThresholdGroupItemVM = new PolicyAirMissedSavingsThresholdGroupItemVM();

            PolicyGroup policyGroup = new PolicyGroup();

            policyGroup = policyGroupRepository.GetGroup(policyAirMissedSavingsThresholdGroupItem.PolicyGroupId);
            policyAirMissedSavingsThresholdGroupItemVM.PolicyGroup = policyGroup;

            policyAirMissedSavingsThresholdGroupItemVM.PolicyAirMissedSavingsThresholdGroupItem = policyAirMissedSavingsThresholdGroupItem;

            //Return Form to Users
            return(View(policyAirMissedSavingsThresholdGroupItemVM));
        }
Exemple #6
0
        public ActionResult Edit(PolicyAirMissedSavingsThresholdGroupItemVM policyAirMissedSavingsThresholdGroupItemVM)
        {
            //Get PolicyAirMissedSavingsThresholdGroupItem
            PolicyAirMissedSavingsThresholdGroupItem policyAirMissedSavingsThresholdGroupItem = new PolicyAirMissedSavingsThresholdGroupItem();

            policyAirMissedSavingsThresholdGroupItem = policyAirMissedSavingsThresholdGroupItemRepository.GetPolicyAirMissedSavingsThresholdGroupItem(policyAirMissedSavingsThresholdGroupItemVM.PolicyAirMissedSavingsThresholdGroupItem.PolicyAirMissedSavingsThresholdGroupItemId);


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

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

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

            //Update Model From Form + Validate against DB
            try
            {
                UpdateModel <PolicyAirMissedSavingsThresholdGroupItem>(policyAirMissedSavingsThresholdGroupItemVM.PolicyAirMissedSavingsThresholdGroupItem, "PolicyAirMissedSavingsThresholdGroupItem");
            }
            catch
            {
                string n = "";
                foreach (ModelState modelState in ViewData.ModelState.Values)
                {
                    foreach (ModelError error in modelState.Errors)
                    {
                        n += error.ErrorMessage;
                    }
                }
                ViewData["Message"] = "ValidationError : " + n;
                return(View("Error"));
            }

            //Save To DB
            try
            {
                policyAirMissedSavingsThresholdGroupItemRepository.Update(policyAirMissedSavingsThresholdGroupItemVM.PolicyAirMissedSavingsThresholdGroupItem);
            }
            catch (SqlException ex)
            {
                LogRepository logRepository = new LogRepository();
                logRepository.LogError(ex.Message);

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

            return(RedirectToAction("List", new { id = policyAirMissedSavingsThresholdGroupItemVM.PolicyAirMissedSavingsThresholdGroupItem.PolicyGroupId }));
        }
 public PolicyAirMissedSavingsThresholdGroupItemVM(PolicyGroup policyGroup, PolicyAirMissedSavingsThresholdGroupItem policyAirMissedSavingsThresholdGroupItem,
                                                   IEnumerable <SelectListItem> currencies,
                                                   IEnumerable <SelectListItem> routingCodes)
 {
     PolicyGroup = policyGroup;
     PolicyAirMissedSavingsThresholdGroupItem = policyAirMissedSavingsThresholdGroupItem;
     RoutingCodes = routingCodes;
 }
        //Delete
        public void Delete(PolicyAirMissedSavingsThresholdGroupItem policyAirMissedItem)
        {
            string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0];

            db.spDesktopDataAdmin_DeletePolicyAirMissedSavingsThresholdGroupItem_v1(
                policyAirMissedItem.PolicyAirMissedSavingsThresholdGroupItemId,
                adminUserGuid,
                policyAirMissedItem.VersionNumber
                );
        }
        public ActionResult Create(PolicyAirMissedSavingsThresholdGroupItemLanguage policyAirMissedSavingsThresholdGroupItemLanguage)
        {
            PolicyAirMissedSavingsThresholdGroupItem policyAirMissedSavingsThresholdGroupItem = new PolicyAirMissedSavingsThresholdGroupItem();

            policyAirMissedSavingsThresholdGroupItem = policyAirMissedSavingsThresholdGroupItemRepository.GetPolicyAirMissedSavingsThresholdGroupItem(policyAirMissedSavingsThresholdGroupItemLanguage.PolicyAirMissedSavingsThresholdGroupItemId);

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

            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToPolicyGroup(policyAirMissedSavingsThresholdGroupItem.PolicyGroupId))
            {
                //AccessRights Error
                return(View("Error"));
            }

            //Update  Model from Form
            try
            {
                UpdateModel(policyAirMissedSavingsThresholdGroupItemLanguage);
            }
            catch
            {
                string n = "";
                foreach (ModelState modelState in ViewData.ModelState.Values)
                {
                    foreach (ModelError error in modelState.Errors)
                    {
                        n += error.ErrorMessage;
                    }
                }
                ViewData["Message"] = "ValidationError : " + n;
                return(View("Error"));
            }

            try
            {
                policyAirMissedSavingsThresholdGroupItemLanguageRepository.Add(policyAirMissedSavingsThresholdGroupItemLanguage);
            }
            catch
            {
                //Insert Error
                return(View("Error"));
            }


            return(RedirectToAction("List", new { id = policyAirMissedSavingsThresholdGroupItem.PolicyAirMissedSavingsThresholdGroupItemId }));
        }
        //GET:List
        public ActionResult List(int id, int?page, string sortField, int?sortOrder)
        {
            //Get PolicyAirMissedSavingsThresholdGroupItem
            PolicyAirMissedSavingsThresholdGroupItem policyAirMissedSavingsThresholdGroupItem = new PolicyAirMissedSavingsThresholdGroupItem();

            policyAirMissedSavingsThresholdGroupItem = policyAirMissedSavingsThresholdGroupItemRepository.GetPolicyAirMissedSavingsThresholdGroupItem(id);

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

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

            if (rolesRepository.HasWriteAccessToPolicyGroup(policyAirMissedSavingsThresholdGroupItem.PolicyGroupId))
            {
                ViewData["Access"] = "WriteAccess";
            }

            //Parent Information
            ViewData["PolicyAirMissedSavingsThresholdGroupItemId"] = policyAirMissedSavingsThresholdGroupItem.PolicyAirMissedSavingsThresholdGroupItemId;
            ViewData["PolicyGroupID"]   = policyAirMissedSavingsThresholdGroupItem.PolicyGroupId;
            ViewData["PolicyGroupName"] = policyGroupRepository.GetGroup(policyAirMissedSavingsThresholdGroupItem.PolicyGroupId).PolicyGroupName;


            //SortField+SortOrder settings
            if (sortField != "MissedSavingsAdvice")
            {
                sortField = "LanguageName";
            }
            if (sortOrder == 1)
            {
                ViewData["NewSortOrder"]     = 0;
                ViewData["CurrentSortOrder"] = 1;
            }
            else
            {
                ViewData["NewSortOrder"]     = 1;
                ViewData["CurrentSortOrder"] = 0;
                sortOrder = 0;
            }

            //Get data
            var cwtPaginatedList = policyAirMissedSavingsThresholdGroupItemLanguageRepository.PagePolicyAirMissedSavingsThresholdGroupItemMissedSavingsAdvice(id, page ?? 1, sortField, sortOrder ?? 0);

            return(View(cwtPaginatedList));
        }
        public ActionResult Delete(int id, string languageCode, FormCollection collection)
        {
            //Get Item
            PolicyAirMissedSavingsThresholdGroupItemLanguage policyAirMissedSavingsThresholdGroupItemLanguage = new PolicyAirMissedSavingsThresholdGroupItemLanguage();

            policyAirMissedSavingsThresholdGroupItemLanguage = policyAirMissedSavingsThresholdGroupItemLanguageRepository.GetItem(id, languageCode);

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

            //Check AccessRights
            PolicyAirMissedSavingsThresholdGroupItem policyAirMissedSavingsThresholdGroupItem = new PolicyAirMissedSavingsThresholdGroupItem();

            policyAirMissedSavingsThresholdGroupItem = policyAirMissedSavingsThresholdGroupItemRepository.GetPolicyAirMissedSavingsThresholdGroupItem(id);
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToPolicyGroup(policyAirMissedSavingsThresholdGroupItem.PolicyGroupId))
            {
                return(View("Error"));
            }

            //Delete Item
            try
            {
                policyAirMissedSavingsThresholdGroupItemLanguage.VersionNumber = Int32.Parse(collection["VersionNumber"]);
                policyAirMissedSavingsThresholdGroupItemLanguageRepository.Delete(policyAirMissedSavingsThresholdGroupItemLanguage);
            }
            catch (SqlException ex)
            {
                //Versioning Error - go to standard versionError page
                if (ex.Message == "SQLVersioningError")
                {
                    ViewData["ReturnURL"] = "/MissedSavingsAdvice.mvc/Delete/" + policyAirMissedSavingsThresholdGroupItemLanguage.PolicyAirMissedSavingsThresholdGroupItemId.ToString() + "/" + policyAirMissedSavingsThresholdGroupItemLanguage.LanguageCode;
                    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", new { id = policyAirMissedSavingsThresholdGroupItemLanguage.PolicyAirMissedSavingsThresholdGroupItemId }));
        }
Exemple #12
0
        // GET: /Create
        public ActionResult Create(int id)
        {
            PolicyGroup policyGroup = new PolicyGroup();

            policyGroup = policyGroupRepository.GetGroup(id);;

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

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

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

            //Create ViewModel
            PolicyAirMissedSavingsThresholdGroupItemVM policyAirMissedSavingsThresholdGroupItemVM = new PolicyAirMissedSavingsThresholdGroupItemVM();

            policyAirMissedSavingsThresholdGroupItemVM.PolicyGroup = policyGroup;

            PolicyAirMissedSavingsThresholdGroupItem policyAirMissedSavingsThresholdGroupItem = new PolicyAirMissedSavingsThresholdGroupItem();

            policyAirMissedSavingsThresholdGroupItem.PolicyGroupId        = policyGroup.PolicyGroupId;
            policyAirMissedSavingsThresholdGroupItem.PolicyProhibitedFlag = false;
            policyAirMissedSavingsThresholdGroupItem.SavingsZeroedOutFlag = false;
            policyAirMissedSavingsThresholdGroupItemVM.PolicyAirMissedSavingsThresholdGroupItem = policyAirMissedSavingsThresholdGroupItem;

            //Currencies
            CurrencyRepository currencyRepository = new CurrencyRepository();

            policyAirMissedSavingsThresholdGroupItemVM.Currencies = new SelectList(currencyRepository.GetAllCurrencies().ToList(), "CurrencyCode", "Name");

            //RoutingCodes
            PolicyAirMissedSavingsThresholdRoutingRepository routingRepository = new PolicyAirMissedSavingsThresholdRoutingRepository();

            policyAirMissedSavingsThresholdGroupItemVM.RoutingCodes = new SelectList(routingRepository.GetAllPolicyAirMissedSavingsThresholdRoutings().ToList(), "RoutingCode", "RoutingDescription");

            //Return Form to Users
            return(View(policyAirMissedSavingsThresholdGroupItemVM));
        }
Exemple #13
0
        public ActionResult Delete(PolicyAirMissedSavingsThresholdGroupItemVM policyAirMissedSavingsThresholdGroupItemVM)
        {
            //Get PolicyAirMissedSavingsThresholdGroupItem
            PolicyAirMissedSavingsThresholdGroupItem policyAirMissedSavingsThresholdGroupItem = new PolicyAirMissedSavingsThresholdGroupItem();

            policyAirMissedSavingsThresholdGroupItem = policyAirMissedSavingsThresholdGroupItemRepository.GetPolicyAirMissedSavingsThresholdGroupItem(policyAirMissedSavingsThresholdGroupItemVM.PolicyAirMissedSavingsThresholdGroupItem.PolicyAirMissedSavingsThresholdGroupItemId);

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

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

            if (!rolesRepository.HasWriteAccessToPolicyGroup(policyAirMissedSavingsThresholdGroupItem.PolicyGroupId))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }
            //Delete Item
            try
            {
                policyAirMissedSavingsThresholdGroupItemRepository.Delete(policyAirMissedSavingsThresholdGroupItemVM.PolicyAirMissedSavingsThresholdGroupItem);
            }
            catch (SqlException ex)
            {
                //Versioning Error - go to standard versionError page
                if (ex.Message == "SQLVersioningError")
                {
                    ViewData["ReturnURL"] = "/PolicyAirMissedSavingsThresholdGroupItem.mvc/Delete/" + policyAirMissedSavingsThresholdGroupItem.PolicyAirMissedSavingsThresholdGroupItemId.ToString();
                    return(View("VersionError"));
                }
                LogRepository logRepository = new LogRepository();
                logRepository.LogError(ex.Message);

                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", new { id = policyAirMissedSavingsThresholdGroupItem.PolicyGroupId }));
        }
        //Add
        public void Add(PolicyAirMissedSavingsThresholdGroupItem policyAirMissedItem)
        {
            string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0];

            db.spDesktopDataAdmin_InsertPolicyAirMissedSavingsThresholdGroupItem_v1(
                policyAirMissedItem.PolicyGroupId,
                policyAirMissedItem.MissedThresholdAmount,
                policyAirMissedItem.CurrencyCode,
                policyAirMissedItem.RoutingCode,
                policyAirMissedItem.EnabledFlag,
                policyAirMissedItem.EnabledDate,
                policyAirMissedItem.ExpiryDate,
                policyAirMissedItem.TravelDateValidFrom,
                policyAirMissedItem.TravelDateValidTo,
                adminUserGuid
                );
        }
        public ActionResult Edit(int id, string languageCode, FormCollection formCollection)
        {
            //Get Item
            PolicyAirMissedSavingsThresholdGroupItemLanguage policyAirMissedSavingsThresholdGroupItemLanguage = new PolicyAirMissedSavingsThresholdGroupItemLanguage();

            policyAirMissedSavingsThresholdGroupItemLanguage = policyAirMissedSavingsThresholdGroupItemLanguageRepository.GetItem(id, languageCode);

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

            //Check AccessRights
            PolicyAirMissedSavingsThresholdGroupItem policyAirMissedSavingsThresholdGroupItem = new PolicyAirMissedSavingsThresholdGroupItem();

            policyAirMissedSavingsThresholdGroupItem = policyAirMissedSavingsThresholdGroupItemRepository.GetPolicyAirMissedSavingsThresholdGroupItem(id);
            RolesRepository rolesRepository = new RolesRepository();

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

            //Update Item from Form
            try
            {
                UpdateModel(policyAirMissedSavingsThresholdGroupItemLanguage);
            }
            catch
            {
                string n = "";
                foreach (ModelState modelState in ViewData.ModelState.Values)
                {
                    foreach (ModelError error in modelState.Errors)
                    {
                        n += error.ErrorMessage;
                    }
                }
                ViewData["Message"] = "ValidationError : " + n;
                return(View("Error"));
            }

            //Update MissedSavingsAdvice
            try
            {
                policyAirMissedSavingsThresholdGroupItemLanguageRepository.Update(policyAirMissedSavingsThresholdGroupItemLanguage);
            }
            catch (SqlException ex)
            {
                //Versioning Error
                if (ex.Message == "SQLVersioningError")
                {
                    ViewData["ReturnURL"] = "/MissedSavingsAdvice.mvc/Edit/" + policyAirMissedSavingsThresholdGroupItemLanguage.PolicyAirMissedSavingsThresholdGroupItemId.ToString();
                    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(RedirectToAction("List", new { id = policyAirMissedSavingsThresholdGroupItemLanguage.PolicyAirMissedSavingsThresholdGroupItemId }));
        }