gpt4 book ai didi

javascript - 当前上下文中不存在名称 'content'

转载 作者:行者123 更新时间:2023-11-28 19:00:59 26 4
gpt4 key购买 nike

我收到此错误,我做错了什么?

` 使用系统; 使用 System.Collections.Generic; 使用 System.Linq; 使用系统.Web; 使用 System.Web.Mvc; 使用 Umbraco.Web.WebApi;

namespace Umbraco.Course.Controllers
{
[MemberAuthorize(AllowType = "IntranetUser")]
public class LikesController : UmbracoApiController
{
[System.Web.Http.HttpGet]
public int LikeStatus(int id)
{
var contentService = Services.ContentService;
var memberService = Services.MemberService;
var relationService = Services.RelationService;

var member = memberService.GetById(Members.GetCurrentMemberId());

var post = contentService.GetById(id);

if (!relationService.AreRelated(content, member, "likes"))
relationService.Relate(post, member, "likes");

var likes = relationService.GetByParent(post, "likes").Count();

post.SetValue("likes", likes);

contentService.PublishWithStatus(post);
return likes;

}
}
}`

最佳答案

if (!relationService.AreRelated(content, member, "likes"))

变量内容未定义。

关于javascript - 当前上下文中不存在名称 'content',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32551324/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com