Example #1
0
        public ActionResult CreateRole(UserRoles role)
        {
            string LoginUser = (string)Session["LoginSAPID"];

            try
            {
                string userkey = ConfigurationManager.AppSettings["userkey"];
                string uid     = ConfigurationManager.AppSettings["uid"];

                Employer.Employer employer = new Employer.Employer();

                var createRole = employer.CreateRole(role.Name, LoginUser, userkey, uid);

                var createStatus = createRole.Split('~');
                if (createStatus[0] != "01")
                {
                    TempData["error"] = createStatus[1];
                    ViewBag.Error     = TempData["error"];
                    //return RedirectToAction("Roles");
                    return(View());
                }
                else
                {
                    TempData["error"] = createStatus[1];
                    ViewBag.Error     = TempData["error"];
                    return(View());
                }
            }
            catch (Exception ex)
            {
                LogError logerror = new LogError();
                logerror.ErrorLog("", LoginUser, "", "Admin/CreateRole", "Admin", "CreateRole", "CreateRole Error", ex.Message.ToString(), 0);
                TempData["error"] = ex.Message.ToString();
                ViewBag.Error     = TempData["error"];
                return(View());
            }
        }