Ejemplo n.º 1
0
        public ActionResult DeleteRole(string id)
        {
            TeamRole role = Actor.Public.GetRole(id);
            NotificationViewModel notification = new NotificationViewModel();

            if (role.IsNotNull())
            {
                Actor.Public.DeleteRole(id, (bool ok) =>
                {
                    if (ok)
                    {
                        notification.Data             = NotificationData.YES;
                        notification.Content          = string.Format("角色:{0}删除成功", role.Name);
                        notification.NotificationType = NotificationType.Success;
                    }
                    else
                    {
                        notification.Data             = NotificationData.NO;
                        notification.Content          = string.Format("角色:{0}删除失败", role.Name);
                        notification.NotificationType = NotificationType.Error;
                    }
                });
            }
            else
            {
                notification.Data             = NotificationData.NO;
                notification.Content          = string.Format("角色ID:{0}不存在!", id);
                notification.NotificationType = NotificationType.Attention;
            }

            return(Result(notification));
        }
Ejemplo n.º 2
0
        public ActionResult CreateRole(string id, string RoleName, string RoleDescription, FormCollection Collection)
        {
            TeamRole role = Actor.Public.CreateRole(RoleName, RoleDescription);
            NotificationViewModel notification = new NotificationViewModel();

            if (role.IsNotNull())
            {
                notification.Data             = NotificationData.YES;
                notification.Content          = string.Format("角色{0}创建成功", RoleName);
                notification.NotificationType = NotificationType.Success;
            }
            else
            {
                notification.Data             = NotificationData.NO;
                notification.Content          = string.Format("创建角色失败,可能{0}角色已经存在", RoleName);
                notification.NotificationType = NotificationType.Error;
            }
            return(Result(notification));
        }