public ActionResult List_user(string user_name, string act, string ctrl, string type_act, string type, string lang, string search, int?page, int?page_size, string order_by, string order_type) { UserModels userModels = new UserModels(); RoleModels roleModels = new RoleModels(); C_User cuser = new C_User(); StringBuilder sb = new StringBuilder(); var list_user_view = new Web.Areas.Admin.ViewModels.List_user_view(); this.TryUpdateModel(list_user_view); int total_record = 0; if (string.IsNullOrEmpty(type)) { type = Request.QueryString["type"] != null ? Request.QueryString["type"].ToString() : string.Empty; } if (type == string.Empty) { list_user_view.Message = "Chúng tôi không tìm thấy danh sách bạn yêu cầu"; } if (string.IsNullOrEmpty(act)) { act = Request.QueryString["act"] != null ? Request.QueryString["act"].ToString() : "list_user"; } if (string.IsNullOrEmpty(ctrl)) { ctrl = Request.QueryString["ctrl"] != null ? Request.QueryString["ctrl"].ToString() : "adminUser"; } if (page == null || page == 0) { page = Request.QueryString["page"] != null?Convert.ToInt32(Request.QueryString["page"].ToString()) : 1; } if (string.IsNullOrEmpty(lang)) { lang = LanguageModels.ActiveLanguage().LangCultureName; } if (page_size == null) { page_size = int.Parse(Util.GetConfigValue("NumberPageSizeAdmin", "30")); } if (user_name != null && type_act != null && type_act == CommonGlobal.Delete) { ////check permission delete if (UserModels.CheckPermission(this.Session["mem"] != null ? this.Session["mem"].ToString() : string.Empty, act, ctrl, type_act, type ?? string.Empty)) { cuser = userModels.GetUserbyUserName(user_name); if (cuser != null) { ////delete user bool rt = userModels.Delete_User(user_name); if (rt) { list_user_view.Message = "Bạn đã xóa " + user_name; } else { list_user_view.Message = "Xóa không thành công"; } } else { list_user_view.Message = "Không tìm thấy : " + user_name; } } else { list_user_view.Message = " Bạn không có quyền thực thi hành động xóa."; } } if (string.IsNullOrEmpty(order_by) || string.IsNullOrEmpty(order_type)) { order_by = "Username"; order_type = "asc"; } list_user_view.Type = type; list_user_view.Cate_type = roleModels.GetRoleByRole(type); list_user_view.Lang = lang; list_user_view.Type_act = type_act; ////tab sb.Append("<li class=\"active\"><a href=\"#\"><span><span>Danh sách " + list_user_view.Cate_type + "</span></span></a></li>"); if (type == "Admin") { sb.Append("<li><a href=\"" + Url.Action("index", "dashboard", new { act = "change_user", ctrl = "adminUser", type = type, type_act = CommonGlobal.Add }) + "\"><span><span>Thêm " + list_user_view.Cate_type + "</span></span></a></li>"); } list_user_view.Html_link_tab = sb.ToString(); ////list language list_user_view.List_language = this.List_select_language(this.Lang); ////list page size and paging list_user_view.List_page_size = this.GetSizePagingPublic((int)page_size); list_user_view.Page = (int)page; list_user_view.Page_size = (int)page_size; ////list catalog list_user_view.Page_list_user = userModels.AdminGetAllUser(type, lang, search, (int)page, (int)page_size, order_by, order_type, out total_record); list_user_view.Search = search; list_user_view.Order_by = order_by; list_user_view.Order_type = order_type; list_user_view.Total_record = total_record; ////acton and parent action list_user_view.Act = act; list_user_view.Ctrl = ctrl; list_user_view.Parent_action = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString(); list_user_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString(); return(this.PartialView("../control/list_user", list_user_view)); }