示例#1
0
        public override bool FanpageOrGroupFBAction(FanpageOrGroupFB FanOrGroup, ActionType type = ActionType.Add)
        {
            if (IsOpenSuccess)
            {
                var fanorgroup = Data.FanOrGroups.Where(f => f.Id.Equals(FanOrGroup.Id)).FirstOrDefault();
                switch (type)
                {
                case ActionType.Add:
                    if (fanorgroup == null)
                    {
                        Data.FanOrGroups.Add(FanOrGroup);
                        Save();
                        return(true);
                    }
                    return(false);

                case ActionType.Edit:
                    if (fanorgroup != null)
                    {
                        Data.FanOrGroups.Remove(fanorgroup);
                        Data.FanOrGroups.Add(FanOrGroup);
                        Save();
                        return(true);
                    }
                    return(false);

                case ActionType.Remove:
                    if (fanorgroup != null)
                    {
                        Data.FanOrGroups.Remove(fanorgroup);
                        Save();
                    }
                    return(true);

                default:
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
 public abstract bool FanpageOrGroupFBAction(FanpageOrGroupFB User, ActionType type = ActionType.Add);