Beispiel #1
0
        public ActionResult AddFriend(string param)
        {
            var message = string.Empty;

            string[] arr = null;

            if (!ParamCheck.CheckLogin(CurrentUser, out message) ||
                !ParamCheck.GetParamArray(param, 1, out message, out arr))
            {
                return(ErrorResult(message));
            }

            var friend = LoadService <ISnsUserService>().GetSnsUserById(arr[0]);

            if (friend == null || string.IsNullOrWhiteSpace(friend.Id))
            {
                return(ErrorResult("好友用户不存在!"));
            }

            if (friend.FriendValidate)
            {
                friend.ValidateMessage = string.Format("我是{0}", CurrentUser.Name);
                return(PartialViewResult("_ValidateFriend", friend));
            }

            var result = LoadService <ISnsUserService>().CreateFriend(CurrentUser.Id, arr[0], false, string.Empty);

            return(JsonResult(result));
        }
Beispiel #2
0
        public ActionResult RemoveAttention(string param)
        {
            var message = string.Empty;

            string[] arr = null;

            if (!ParamCheck.CheckLogin(CurrentUser, out message) ||
                !ParamCheck.GetParamArray(param, 1, out message, out arr))
            {
                return(ErrorResult(message));
            }

            var result = LoadService <ISnsUserService>().RemoveAttention(CurrentUser.Id, arr[0]);

            return(JsonResult(result));
        }
Beispiel #3
0
        public ActionResult ValidateFriend(string param)
        {
            var message = string.Empty;

            string[] arr = null;

            if (!ParamCheck.CheckLogin(CurrentUser, out message) ||
                !ParamCheck.GetParamArray(param, 2, out message, out arr))
            {
                return(ErrorResult(message));
            }

            var result = LoadService <ISnsUserService>().CreateFriend(CurrentUser.Id, arr[0], true, arr[1]);

            return(JsonResult(result));
        }
Beispiel #4
0
        public ActionResult AddActivity(string param)
        {
            var message = string.Empty;

            string[] arr = null;

            if (!ParamCheck.CheckLogin(CurrentUser, out message) ||
                !ParamCheck.GetParamArray(param, 2, out message, out arr))
            {
                return(ErrorResult(message));
            }

            var range  = (ViewRange)int.Parse(arr[0]);
            var result = LoadService <IActivityService>().PublishActivity(CurrentUser, range, arr[1]);

            return(JsonResult(result));
        }