Exemple #1
0
        public ActionResult CreateOrganisationUnit(Organisationsenhet orgenhet)
        {
            var org = new Organisation();

            if (ModelState.IsValid)
            {
                try
                {
                    var userName = User.Identity.GetUserName();
                    _portalAdminService.SkapaOrganisationsenhet(orgenhet, userName);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    ErrorManager.WriteToErrorLog("OrganisationController", "CreateOrganisationUnit", e.ToString(), e.HResult, User.Identity.Name);
                    var errorModel = new CustomErrorPageModel
                    {
                        Information  = "Ett fel inträffade när ny organisationsenhet skulle sparas.",
                        ContactEmail = ConfigurationManager.AppSettings["ContactEmail"],
                    };
                    return(View("CustomError", errorModel));
                }
                return(RedirectToAction("GetOrganisationsOrgUnits", new { selectedOrgId = orgenhet.OrganisationsId }));
            }

            return(View());
        }