Exemplo n.º 1
0
        public static string AddOrUpdateFunctionRole(string roleId, string lsFunction)
        {
            AjaxResponse response    = new AjaxResponse();
            var          strresponse = "";

            if (!string.IsNullOrEmpty(lsFunction))
            {
                xRPDataContext         dts = new xRPDataContext();
                Sys_FunctionRepository functionRepository = new Sys_FunctionRepository();
                var user = (from u in dts.aspnet_Users where u.UserName == HttpContext.Current.User.Identity.Name select u).FirstOrDefault();

                var dataQuyenTheoChucNangs = new JavaScriptSerializer().Deserialize <List <Sys_QuyenTheoChucNang> >(lsFunction);
                response.IsSuccess = functionRepository.AddOrUpdateFunctionRole(new Guid(roleId), dataQuyenTheoChucNangs, user.UserId, ref strresponse);
                response.Message   = strresponse.EncodeJsString();
            }
            else
            {
                response.IsSuccess = false;
                response.Message   = "Quá trình thực hiện không thành công".EncodeJsString();
            }
            return(JsonConvert.SerializeObject(response));
        }