public ActionResult CreateInformationText(SystemViewModels.InfoTextViewModel model) { if (ModelState.IsValid) { try { var userName = User.Identity.GetUserName(); var infoText = new AdmInformation { Informationstyp = model.Informationstyp, Text = model.Text, }; infoText.Text = model.Text; _portalAdminService.SkapaInformationsText(infoText, userName); } catch (Exception e) { Console.WriteLine(e); ErrorManager.WriteToErrorLog("SystemController", "CreateInfoText", e.ToString(), e.HResult, User.Identity.Name); var errorModel = new CustomErrorPageModel { Information = "Ett fel inträffade när ny informationstext skulle sparas.", ContactEmail = ConfigurationManager.AppSettings["ContactEmail"], }; return(View("CustomError", errorModel)); } return(RedirectToAction("GetInformationTexts")); } return(View()); }