コード例 #1
0
        public JsonResult LikePost(long id)
        {
            var result = new JsonResultLikeSub {
                Success = true
            };

            try
            {
                var resDB = BLL.Data.LikePostById(id, _currentUserId);
                if (resDB != 0)
                {
                    result.Added = true;
                }
                else
                {
                    result.Added = false;
                }
                result.Result = resDB;
            }
            catch (Exception ex)
            {
                result.Success = false;
                result.Result  = ex.Message;
            }
            return(Json(result));
        }
コード例 #2
0
        public JsonResult AddSubcribtion(long userId, long subTo)
        {
            var result = new JsonResultLikeSub {
                Success = true
            };

            try
            {
                var resDB = BLL.Data.CreateUpdateSubscription(userId, subTo);
                result.Added = resDB;
            }
            catch (Exception ex)
            {
                result.Success = false;
                result.Result  = ex.Message;
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }