public ActionResult ViewRoles() { Users eUsers = new Users(); int UserId = Convert.ToInt32(Url.RequestContext.RouteData.Values["Id"]); ViewBag.UserId = UserId; eUsers.UserId = UserId; UsersBI.LoadUsers(ref eUsers); ViewBag.Username = eUsers.Username; FASM_EN.User.Roles eRoles = new FASM_EN.User.Roles(); eRoles.dtRoles = RolesBI.ShowRoles(UserId); return(View(eRoles)); }
public ActionResult EditUsers(Users eUsers) { if (eUsers.isLoad == false) { eUsers.UserId = Convert.ToInt32(Request.Params["UserId"]); UsersBI.LoadUsers(ref eUsers); return(PartialView(eUsers)); } else { if (ModelState.IsValid) { try { string message = ""; FASM_Enums.InfoMessages SaveResult = UsersBI.SaveUsers(ref eUsers); switch (SaveResult) { case FASM_Enums.InfoMessages.Success: message = FASM_Msg.Updated; break; case FASM_Enums.InfoMessages.AlreadyExist: message = "The username already exist!"; break; } return(Json(new { msg = message, JsonRequestBehavior.AllowGet })); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); } } } return(View()); }