public ActionResult Delete(int id, string languageCode) { GDSEndWarningConfigurationLanguage gdsEndWarningConfigurationLanguage = new GDSEndWarningConfigurationLanguage(); gdsEndWarningConfigurationLanguage = gdsEndWarningConfigurationLanguageRepository.GetItem(id, languageCode); //Check Exists if (gdsEndWarningConfigurationLanguage == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } GDSEndWarningConfigurationLanguageVM gdsEndWarningConfigurationLanguageVM = new GDSEndWarningConfigurationLanguageVM(); //Get GDSEndWarningConfiguration From Database GDSEndWarningConfiguration gdsEndWarningConfiguration = new GDSEndWarningConfiguration(); gdsEndWarningConfiguration = gdsEndWarningConfigurationRepository.GetGroup(gdsEndWarningConfigurationLanguage.GDSEndWarningConfigurationId); //Check Exists if (gdsEndWarningConfiguration == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } gdsEndWarningConfigurationLanguageVM.GDSEndWarningConfiguration = gdsEndWarningConfiguration; gdsEndWarningConfigurationLanguageVM.GDSEndWarningConfigurationLanguage = gdsEndWarningConfigurationLanguage; return(View(gdsEndWarningConfigurationLanguageVM)); }
// // GET: /GDSEndWarningConfigurationLanguage/List public ActionResult List(int id, string filter, int?page, string sortField, int?sortOrder) { //SortField if (sortField == string.Empty) { sortField = "GDSResponseId"; } ViewData["CurrentSortField"] = sortField; //SortOrder if (sortOrder == 1) { ViewData["NewSortOrder"] = 0; ViewData["CurrentSortOrder"] = 1; } else { ViewData["NewSortOrder"] = 1; ViewData["CurrentSortOrder"] = 0; sortOrder = 0; } GDSEndWarningConfigurationLanguagesVM GDSEndWarningConfigurationLanguagesVM = new GDSEndWarningConfigurationLanguagesVM(); //Set Access Rights if (hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { GDSEndWarningConfigurationLanguagesVM.HasWriteAccess = true; } //Get GDSEndWarningConfigurationLanguages if (gdsEndWarningConfigurationLanguageRepository != null) { var GDSEndWarningConfigurationLanguages = gdsEndWarningConfigurationLanguageRepository.PageGDSEndWarningConfigurationLanguages(id, page ?? 1, filter ?? "", sortField, sortOrder ?? 0); if (GDSEndWarningConfigurationLanguages != null) { GDSEndWarningConfigurationLanguagesVM.GDSEndWarningConfigurationLanguages = GDSEndWarningConfigurationLanguages; } } //Get GDSEndWarningConfiguration From Database GDSEndWarningConfiguration gdsEndWarningConfiguration = new GDSEndWarningConfiguration(); gdsEndWarningConfiguration = gdsEndWarningConfigurationRepository.GetGroup(id); //Check Exists if (gdsEndWarningConfiguration == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } GDSEndWarningConfigurationLanguagesVM.GDSEndWarningConfiguration = gdsEndWarningConfiguration; //return items return(View(GDSEndWarningConfigurationLanguagesVM)); }
// GET: /GDSEndWarningConfiguration/Edit public ActionResult Edit(int id) { //Get Item From Database GDSEndWarningConfiguration gdsEndWarningConfiguration = new GDSEndWarningConfiguration(); gdsEndWarningConfiguration = gdsEndWarningConfigurationRepository.GetGroup(id); //Check Exists if (gdsEndWarningConfiguration == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } //Check Access if (!rolesRepository.HasWriteAccessToGDSEndWarningConfiguration()) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } GDSEndWarningConfigurationVM gdsEndWarningConfigurationVM = new GDSEndWarningConfigurationVM(); gdsEndWarningConfigurationVM.GDSEndWarningConfiguration = gdsEndWarningConfiguration; //GDS List GDSRepository gDSRepository = new GDSRepository(); SelectList gDSs = new SelectList(gDSRepository.GetClientProfileBuilderGDSs().ToList(), "GDSCode", "GDSName", gdsEndWarningConfiguration.GDSCode); gdsEndWarningConfigurationVM.GDSs = gDSs; //GDSEndWarningBehaviorTypes GDSEndWarningBehaviorTypeRepository gdsEndWarningBehaviorTypeRepository = new GDSEndWarningBehaviorTypeRepository(); SelectList gdsEndWarningBehaviorTypes = new SelectList(gdsEndWarningBehaviorTypeRepository.GetAllGDSEndWarningBehaviorTypes().ToList(), "GDSEndWarningBehaviorTypeId", "GDSEndWarningBehaviorTypeDescription", gdsEndWarningConfiguration.GDSEndWarningBehaviorTypeId); gdsEndWarningConfigurationVM.GDSEndWarningBehaviorTypes = gdsEndWarningBehaviorTypes; //Automated Commands if (gdsEndWarningConfigurationVM.GDSEndWarningConfiguration.AutomatedCommands == null || (gdsEndWarningConfigurationVM.GDSEndWarningConfiguration.AutomatedCommands != null && gdsEndWarningConfigurationVM.GDSEndWarningConfiguration.AutomatedCommands.Count < 1)) { List <AutomatedCommand> automatedCommands = new List <AutomatedCommand>(); AutomatedCommand automatedCommand = new AutomatedCommand() { CommandExecutionSequenceNumber = 1 }; automatedCommands.Add(automatedCommand); ViewData["AutomatedCommands"] = automatedCommands; } else { ViewData["AutomatedCommands"] = gdsEndWarningConfigurationVM.GDSEndWarningConfiguration.AutomatedCommands; } ViewData["WarningMessage"] = gdsEndWarningConfiguration.IdentifyingWarningMessage; return(View(gdsEndWarningConfigurationVM)); }
public GDSEndWarningConfigurationsVM( GDSEndWarningConfiguration gdsEndWarningConfiguration, CWTPaginatedList <spDesktopDataAdmin_SelectGDSEndWarningConfigurations_v1Result> gdsEndWarningConfigurations, bool hasWriteAccess) { GDSEndWarningConfiguration = gdsEndWarningConfiguration; GDSEndWarningConfigurations = gdsEndWarningConfigurations; HasWriteAccess = hasWriteAccess; }
public GDSEndWarningConfigurationLanguageVM( GDSEndWarningConfigurationLanguage gdsEndWarningConfigurationLanguage, GDSEndWarningConfiguration gdsEndWarningConfiguration, IEnumerable <SelectListItem> languages) { GDSEndWarningConfigurationLanguage = gdsEndWarningConfigurationLanguage; GDSEndWarningConfiguration = gdsEndWarningConfiguration; Languages = languages; }
public ServiceFundsVM( GDSEndWarningConfiguration gdsEndWarningConfiguration, CWTPaginatedList <spDesktopDataAdmin_SelectServiceFunds_v1Result> serviceFunds, bool hasWriteAccess, bool canEditOrder) { ServiceFunds = serviceFunds; HasWriteAccess = hasWriteAccess; CanEditOrder = canEditOrder; }
public void Delete(GDSEndWarningConfiguration gdsEndWarningConfiguration) { string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0]; db.spDesktopDataAdmin_DeleteGDSEndWarningConfiguration_v1( gdsEndWarningConfiguration.GDSEndWarningConfigurationId, adminUserGuid, gdsEndWarningConfiguration.VersionNumber ); }
public PolicyOtherGroupHeadersVM( GDSEndWarningConfiguration gdsEndWarningConfiguration, CWTPaginatedList <spDesktopDataAdmin_SelectPolicyOtherGroupHeaders_v1Result> policyOtherGroupHeaders, bool hasWriteAccess, bool canEditOrder) { PolicyOtherGroupHeaders = policyOtherGroupHeaders; HasWriteAccess = hasWriteAccess; CanEditOrder = canEditOrder; }
public ActionResult Delete(GDSEndWarningConfigurationVM gdsEndWarningConfigurationVM) { //Check Valid Item passed in Form if (gdsEndWarningConfigurationVM.GDSEndWarningConfiguration == null) { ViewData["ActionMethod"] = "DeletePost"; return(View("RecordDoesNotExistError")); } //Get Item From Database GDSEndWarningConfiguration gdsEndWarningConfiguration = new GDSEndWarningConfiguration(); gdsEndWarningConfiguration = gdsEndWarningConfigurationRepository.GetGroup(gdsEndWarningConfigurationVM.GDSEndWarningConfiguration.GDSEndWarningConfigurationId); //Check Exists if (gdsEndWarningConfiguration == null) { ViewData["ActionMethod"] = "DeletePost"; return(View("RecordDoesNotExistError")); } //Check Access if (!rolesRepository.HasWriteAccessToGDSEndWarningConfiguration()) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Delete Form Item try { gdsEndWarningConfigurationRepository.Delete(gdsEndWarningConfigurationVM.GDSEndWarningConfiguration); } catch (SqlException ex) { //Versioning Error - go to standard versionError page if (ex.Message == "SQLVersioningError") { ViewData["ReturnURL"] = "/GDSEndWarningConfiguration.mvc/Delete/" + gdsEndWarningConfigurationVM.GDSEndWarningConfiguration.GDSEndWarningConfigurationId; 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(RedirectToAction("List")); }
//Edit GDSEndWarningConfiguration public void Edit(GDSEndWarningConfiguration gdsEndWarningConfiguration) { string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0]; //AutomatedCommands to XML XmlDocument doc = new XmlDocument(); XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", null, null); doc.AppendChild(dec); XmlElement root = doc.CreateElement("AutomatedCommands"); doc.AppendChild(root); if (gdsEndWarningConfiguration.AutomatedCommands != null) { foreach (AutomatedCommand automatedCommand in gdsEndWarningConfiguration.AutomatedCommands) { if (automatedCommand != null) { if (automatedCommand.CommandText != null && automatedCommand.CommandText != null) { XmlElement xmlAutomatedCommand = doc.CreateElement("AutomatedCommand"); XmlElement xmlCommandText = doc.CreateElement("CommandText"); xmlCommandText.InnerText = automatedCommand.CommandText; xmlAutomatedCommand.AppendChild(xmlCommandText); XmlElement xmlCommandExecutionSequenceNumber = doc.CreateElement("CommandExecutionSequenceNumber"); xmlCommandExecutionSequenceNumber.InnerText = automatedCommand.CommandExecutionSequenceNumber.ToString(); xmlAutomatedCommand.AppendChild(xmlCommandExecutionSequenceNumber); root.AppendChild(xmlAutomatedCommand); } } } } db.spDesktopDataAdmin_UpdateGDSEndWarningConfiguration_v1( gdsEndWarningConfiguration.GDSEndWarningConfigurationId, gdsEndWarningConfiguration.GDSCode, gdsEndWarningConfiguration.IdentifyingWarningMessage, gdsEndWarningConfiguration.GDSEndWarningBehaviorTypeId, System.Xml.Linq.XElement.Parse(doc.OuterXml), adminUserGuid ); }
public ActionResult Delete(int id) { GDSEndWarningConfiguration gdsEndWarningConfiguration = new GDSEndWarningConfiguration(); gdsEndWarningConfiguration = gdsEndWarningConfigurationRepository.GetGroup(id); //Check Exists if (gdsEndWarningConfiguration == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } GDSEndWarningConfigurationVM GDSEndWarningConfigurationVM = new GDSEndWarningConfigurationVM(); GDSEndWarningConfigurationVM.GDSEndWarningConfiguration = gdsEndWarningConfiguration; ViewData["WarningMessage"] = gdsEndWarningConfiguration.IdentifyingWarningMessage; return(View(GDSEndWarningConfigurationVM)); }
// // GET: /GDSEndWarningConfigurationLanguage/Create public ActionResult Create(int id) { //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } GDSEndWarningConfigurationLanguageVM gdsEndWarningConfigurationLanguageVM = new GDSEndWarningConfigurationLanguageVM(); //Get GDSEndWarningConfiguration From Database GDSEndWarningConfiguration gdsEndWarningConfiguration = new GDSEndWarningConfiguration(); gdsEndWarningConfiguration = gdsEndWarningConfigurationRepository.GetGroup(id); //Check Exists if (gdsEndWarningConfiguration == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } gdsEndWarningConfigurationLanguageVM.GDSEndWarningConfiguration = gdsEndWarningConfiguration; //Language List SelectList languages = new SelectList(gdsEndWarningConfigurationLanguageRepository.GetAllAvailableLanguages(id), "LanguageCode", "LanguageName"); gdsEndWarningConfigurationLanguageVM.Languages = languages; GDSEndWarningConfigurationLanguage gdsEndWarningConfigurationLanguage = new GDSEndWarningConfigurationLanguage(); gdsEndWarningConfigurationLanguage.GDSEndWarningConfigurationId = id; gdsEndWarningConfigurationLanguageVM.GDSEndWarningConfigurationLanguage = gdsEndWarningConfigurationLanguage; return(View(gdsEndWarningConfigurationLanguageVM)); }
// // GET: /GDSEndWarningConfiguration/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")); } GDSEndWarningConfigurationVM gdsEndWarningConfigurationVM = new GDSEndWarningConfigurationVM(); //GDS List GDSRepository gDSRepository = new GDSRepository(); SelectList gDSs = new SelectList(gDSRepository.GetClientProfileBuilderGDSs().ToList(), "GDSCode", "GDSName"); gdsEndWarningConfigurationVM.GDSs = gDSs; //GDSEndWarningBehaviorTypes GDSEndWarningBehaviorTypeRepository gdsEndWarningBehaviorTypeRepository = new GDSEndWarningBehaviorTypeRepository(); SelectList gdsEndWarningBehaviorTypes = new SelectList(gdsEndWarningBehaviorTypeRepository.GetAllGDSEndWarningBehaviorTypes().ToList(), "GDSEndWarningBehaviorTypeId", "GDSEndWarningBehaviorTypeDescription"); gdsEndWarningConfigurationVM.GDSEndWarningBehaviorTypes = gdsEndWarningBehaviorTypes; //Automated Commands List <AutomatedCommand> automatedCommands = new List <AutomatedCommand>(); AutomatedCommand automatedCommand = new AutomatedCommand(); automatedCommands.Add(automatedCommand); gdsEndWarningConfigurationVM.AutomatedCommands = automatedCommands; GDSEndWarningConfiguration gdsEndWarningConfiguration = new GDSEndWarningConfiguration(); gdsEndWarningConfigurationVM.GDSEndWarningConfiguration = gdsEndWarningConfiguration; return(View(gdsEndWarningConfigurationVM)); }
public ActionResult Create(GDSEndWarningConfigurationVM GDSEndWarningConfigurationVM, FormCollection formCollection) { //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //We need to extract group from groupVM GDSEndWarningConfiguration gdsEndWarningConfiguration = new GDSEndWarningConfiguration(); gdsEndWarningConfiguration = GDSEndWarningConfigurationVM.GDSEndWarningConfiguration; if (gdsEndWarningConfiguration == null) { ViewData["Message"] = "ValidationError : missing item";; return(View("Error")); } //Create Automated Commands from Post values System.Data.Linq.EntitySet <AutomatedCommand> AutomatedCommands = new System.Data.Linq.EntitySet <AutomatedCommand>(); foreach (string key in formCollection) { if (key.StartsWith("AutomatedCommand") && !string.IsNullOrEmpty(formCollection[key])) { AutomatedCommand automatedCommand = new AutomatedCommand() { CommandText = formCollection[key], CommandExecutionSequenceNumber = int.Parse(key.Replace("AutomatedCommand_", "")) }; AutomatedCommands.Add(automatedCommand); } } if (AutomatedCommands != null && AutomatedCommands.Count > 0) { gdsEndWarningConfiguration.AutomatedCommands = AutomatedCommands; } //Update Model From Form + Validate against DB try { UpdateModel <GDSEndWarningConfiguration>(gdsEndWarningConfiguration, "GDSEndWarningConfiguration"); } 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")); } //Database Update try { gdsEndWarningConfigurationRepository.Add(gdsEndWarningConfiguration); } catch (SqlException ex) { //Non-Unique Name if (ex.Message == "NonUniqueName") { return(View("NonUniqueNameError")); } 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")); } ViewData["NewSortOrder"] = 0; return(RedirectToAction("List")); }
public ActionResult Edit(GDSEndWarningConfigurationVM gdsEndWarningConfigurationVM, FormCollection formCollection) { //Get Item GDSEndWarningConfiguration gdsEndWarningConfiguration = new GDSEndWarningConfiguration(); gdsEndWarningConfiguration = gdsEndWarningConfigurationRepository.GetGroup(gdsEndWarningConfigurationVM.GDSEndWarningConfiguration.GDSEndWarningConfigurationId); //Check Exists if (gdsEndWarningConfiguration == null) { ViewData["ActionMethod"] = "EditPost"; return(View("RecordDoesNotExistError")); } //Check Access Rights if (!rolesRepository.HasWriteAccessToGDSEndWarningConfiguration()) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Create Automated Commands from Post values System.Data.Linq.EntitySet <AutomatedCommand> AutomatedCommands = new System.Data.Linq.EntitySet <AutomatedCommand>(); foreach (string key in formCollection) { if (key.StartsWith("AutomatedCommand") && !string.IsNullOrEmpty(formCollection[key])) { AutomatedCommand automatedCommand = new AutomatedCommand() { CommandText = formCollection[key], CommandExecutionSequenceNumber = int.Parse(key.Replace("AutomatedCommand_", "")) }; AutomatedCommands.Add(automatedCommand); } } //Remove Automated Commands if not set, otherwise add new ones in gdsEndWarningConfiguration.AutomatedCommands = (AutomatedCommands != null && AutomatedCommands.Count > 0) ? AutomatedCommands : null; //Update Model From Form + Validate against DB try { UpdateModel <GDSEndWarningConfiguration>(gdsEndWarningConfiguration, "GDSEndWarningConfiguration"); } 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")); } //Database Update try { gdsEndWarningConfigurationRepository.Edit(gdsEndWarningConfiguration); } catch (SqlException ex) { //Non-Unique Name if (ex.Message == "NonUniqueName") { return(View("NonUniqueNameError")); } //Versioning Error if (ex.Message == "SQLVersioningError") { ViewData["ReturnURL"] = "/GDSEndWarningConfiguration.mvc/Edit/" + gdsEndWarningConfiguration.GDSEndWarningConfigurationId; 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(RedirectToAction("List")); }
// GET: /GDSEndWarningConfigurationLanguage/Edit public ActionResult Edit(int id, string languageCode) { //Get Item From Database GDSEndWarningConfigurationLanguage gdsEndWarningConfigurationLanguage = new GDSEndWarningConfigurationLanguage(); gdsEndWarningConfigurationLanguage = gdsEndWarningConfigurationLanguageRepository.GetItem(id, languageCode); //Check Exists if (gdsEndWarningConfigurationLanguage == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } //Check Access RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToGDSEndWarningConfiguration()) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } GDSEndWarningConfigurationLanguageVM gdsEndWarningConfigurationLanguageVM = new GDSEndWarningConfigurationLanguageVM(); gdsEndWarningConfigurationLanguageVM.GDSEndWarningConfigurationLanguage = gdsEndWarningConfigurationLanguage; //Get GDSEndWarningConfiguration From Database GDSEndWarningConfiguration gdsEndWarningConfiguration = new GDSEndWarningConfiguration(); gdsEndWarningConfiguration = gdsEndWarningConfigurationRepository.GetGroup(id); //Check Exists if (gdsEndWarningConfiguration == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } gdsEndWarningConfigurationLanguageVM.GDSEndWarningConfiguration = gdsEndWarningConfiguration; //Language List - Get available plus current language List <Language> availableLanguages = gdsEndWarningConfigurationLanguageRepository.GetAllAvailableLanguages(id); LanguageRepository languageRepository = new LanguageRepository(); Language selectedLanguage = languageRepository.GetLanguage(gdsEndWarningConfigurationLanguage.LanguageCode); if (selectedLanguage != null) { availableLanguages.Add(selectedLanguage); } SelectList languages = new SelectList(availableLanguages.OrderBy(x => x.LanguageName), "LanguageCode", "LanguageName", gdsEndWarningConfigurationLanguage.LanguageCode); gdsEndWarningConfigurationLanguageVM.Languages = languages; gdsEndWarningConfigurationLanguage.GDSEndWarningConfigurationId = id; gdsEndWarningConfigurationLanguageVM.GDSEndWarningConfigurationLanguage = gdsEndWarningConfigurationLanguage; return(View(gdsEndWarningConfigurationLanguageVM)); }
public ActionResult Create(GDSEndWarningConfigurationLanguageVM gdsEndWarningConfigurationLanguageVM) { //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //We need to extract group from groupVM GDSEndWarningConfigurationLanguage gdsEndWarningConfigurationLanguage = new GDSEndWarningConfigurationLanguage(); gdsEndWarningConfigurationLanguage = gdsEndWarningConfigurationLanguageVM.GDSEndWarningConfigurationLanguage; if (gdsEndWarningConfigurationLanguage == null) { ViewData["Message"] = "ValidationError : missing item";; return(View("Error")); } //Get GDSEndWarningConfiguration From Database GDSEndWarningConfiguration gdsEndWarningConfiguration = new GDSEndWarningConfiguration(); gdsEndWarningConfiguration = gdsEndWarningConfigurationRepository.GetGroup(gdsEndWarningConfigurationLanguage.GDSEndWarningConfigurationId); //Check Exists if (gdsEndWarningConfiguration == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } gdsEndWarningConfigurationLanguage.GDSEndWarningConfiguration = gdsEndWarningConfiguration; gdsEndWarningConfigurationLanguageVM.GDSEndWarningConfigurationLanguage.GDSEndWarningConfigurationId = gdsEndWarningConfiguration.GDSEndWarningConfigurationId; //Update Model From Form + Validate against DB try { UpdateModel <GDSEndWarningConfigurationLanguage>(gdsEndWarningConfigurationLanguage, "GDSEndWarningConfigurationLanguage"); } 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")); } //Database Update try { gdsEndWarningConfigurationLanguageRepository.Add(gdsEndWarningConfigurationLanguage); } 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")); } ViewData["NewSortOrder"] = 0; return(RedirectToAction("List", new { id = gdsEndWarningConfigurationLanguage.GDSEndWarningConfigurationId })); }