Ejemplo n.º 1
0
        public ActionResult UserRole(LoanViewModel lvm, FormCollection form)
        {
            try
            {
                int roleid = Convert.ToInt16(form["roleid"]);
                int userid = Convert.ToInt16(form["id"]);
                userroles.RoleId = roleid;
                userroles.UserId = userid;
                userroles.RoleId = DataReaders.selectRolesByName(userroles);
                if (userroles.RoleId != 0)
                {
                    TempData["message"] = "User Already Have This Role";
                    return(View(""));
                }
                else

                {
                    userroles.RoleId     = roleid;
                    userroles.UserId     = userid;
                    userroles.IsVissible = 1;
                    userroles.dates      = DateTime.Now;

                    DataCreators.InsertUserRoles(userroles);
                    TempData["message"]     = "User n Roles Created Succesfully";
                    lvm.getAllUserAndRoless = getAllUsersAndRoles();
                }
                return(View(""));
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }