Example #1
0
        public JsonResult AddRole(Role roleModel)
        {
            IRoleService roleService = ServiceFactory.Create <IRoleService>();
            bool         flage       = roleService.Exists(t => t.StoreID == CurrentInfo.CurrentStore.ID && t.Name == roleModel.Name);

            if (flage)
            {
                return(Json(new Result(false, "数据库已经存在同名角色"), JsonRequestBehavior.AllowGet));
            }

            roleModel.ShopsID = CurrentInfo.CurrentShop.ID;
            //roleModel.StoreID = CurrentInfo.CurrentStore.ID;
            roleModel.CreateUserID = CurrentInfo.CurrentUser.ID;
            roleModel.CreateTime   = DateTime.Now;
            var data = roleService.AddEntity(roleModel);

            return(Json(new Result(data != null, ResultType.Add), JsonRequestBehavior.AllowGet));
        }