Ejemplo n.º 1
0
        public ActionResult CreateRoles(FASM_EN.User.Roles eRoles)
        {
            string message = "";

            if (ModelState.IsValid)
            {
                try
                {
                    FASM_Enums.InfoMessages SaveResult = RolesBI.SaveRoles(ref eRoles);
                    switch (SaveResult)
                    {
                    case FASM_Enums.InfoMessages.Success:
                        message = FASM_Msg.SuccessfulSaved;
                        break;

                    case FASM_Enums.InfoMessages.AlreadyExist:
                        message = "Sorry! the role name already exist";
                        break;
                    }
                    return(Json(new { msg = message, JsonRequestBehavior.AllowGet }));
                }
                catch (Exception ex)
                {
                    ViewBag.CatchedMsg = ex.Message;
                }
            }

            return(View(eRoles));
        }
Ejemplo n.º 2
0
        public ActionResult EditRoles(FASM_EN.User.Roles eRoles)
        {
            if (eRoles.isLoad == false)
            {
                eRoles.RoleId = Convert.ToInt32(Request.Params["RoleId"]);
                RolesBI.LoadRoles(ref eRoles);
                return(PartialView(eRoles));
            }
            else
            {
                string message = "";
                if (ModelState.IsValid)
                {
                    try
                    {
                        FASM_Enums.InfoMessages Results = RolesBI.SaveRoles(ref eRoles);

                        switch (Results)
                        {
                        case FASM_Enums.InfoMessages.Success:
                            message = FASM_Msg.Updated;
                            break;

                        case FASM_Enums.InfoMessages.AlreadyExist:
                            message = "Sorry! the role name already exist";
                            break;
                        }
                        return(Json(new { msg = message, JsonRequestBehavior.AllowGet }));
                    }
                    catch (Exception ex)
                    {
                        ViewBag.CatchedMsg = ex.Message;
                    }
                }
            }

            return(View(eRoles));
        }