使用标签助手,您可以定义一个可以轻松编写内容的区域。例如,我可以制作一个引导卡标签助手,并轻松地在卡体标签内渲染我想要的任何内容。使用剃须刀组件我怎样才能实现这一目标?
<div class="card">
<div class="card-header"></div>
<div class="card-body">
@*render content here*@
</div>
</div>
Run Code Online (Sandbox Code Playgroud) public async Task<bool> IsParagemOnGoingAsync(int registoId)
{
return await _context.ParagensRegistos
.Where(pr => pr.RegistoId == registoId)
.Any(pr => pr.HoraFim == null);
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能使这个异步?我在谷歌上找不到任何东西...
编辑
我知道 AnyAsync();
我尝试了多次,但从来没有智能感知来添加引用。
我有一个问题,如果我手动转到登录页面之后的页面,我的策略句柄之一会出现异常,因为它找不到索赔。
为什么会发生这种情况,而不是将用户重定向到登录页面,因为他没有经过身份验证?我什至设置了身份验证方案,因为我的所有页面都有
[Authorize("scheme"), Policy = "policy"]
Run Code Online (Sandbox Code Playgroud)
这是我的整个启动代码
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication()
.AddCookie("ProductionAuth", options =>
{
options.ExpireTimeSpan = TimeSpan.FromDays(1);
options.LoginPath = new PathString("/Production/Index");
options.LogoutPath = new PathString("/Production/Logout");
options.AccessDeniedPath = new PathString("/Production/AccessDenied/");
options.SlidingExpiration = true;
})
.AddCookie("AdministrationAuth", options =>
{
options.ExpireTimeSpan = TimeSpan.FromDays(1);
options.LoginPath = …Run Code Online (Sandbox Code Playgroud) 嗨,我可以像这样使用 vue js axios 将帖子发送到 Asp .NET Core 2.2 中的控制器
axios({
url: '/Parametros/Create',
method: 'post',
ContentType: 'application/json',
data: formData
})
Run Code Online (Sandbox Code Playgroud)
但是为了这个工作,我必须从我在控制器中的动作中删除
[ValidateAntiForgeryToken]
Run Code Online (Sandbox Code Playgroud)
此外,令牌在剃刀页面中作为输入生成
<input name="__RequestVerificationToken" type="hidden" value="CfDJ8GwWLSmGzLVOqfs-yISjocyQshOjT98BeCqxo14sO91JGUZPe_IstyK9DWZyu0rCr0bxdx3lBlwminvxm7q0zXVWcUkAZIH8NwKDYGdNCiY-Z_BgMzLt_1PyNEHxfpmTouJgMu3il8N4fMjbI0ohwElXGK-eVLXGuzj_J5N_uQ3A4f-9ijmTKGk8p3BC7hrB1A">
Run Code Online (Sandbox Code Playgroud)
我试过
axios({
url: '/Parametros/Create',
method: 'post',
headers: {
"__RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val();
}
ContentType: 'application/json',
data: formData
})
Run Code Online (Sandbox Code Playgroud)
和
axios({
url: '/Parametros/Create',
method: 'post',
ContentType: 'application/json',
data: {
"__RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val(),
formData
}
})
Run Code Online (Sandbox Code Playgroud)
没有工作,我不断收到糟糕的请求......使用 ajax 第二种方法可以正常工作,但 axios 不行。我该如何处理?
我正在尝试使用引导程序选项卡制作表单向导。布局很简单
垂直选项卡,如侧边栏菜单和右侧的内容
| Tab1 | |
| Tab2 | Content |
| Tab3 | |
Run Code Online (Sandbox Code Playgroud)
为此,我使用了 bootstrap 网格,但有一个问题,如果我减小浏览器大小,内容将位于选项卡下。
尽管浏览器大小不同,有没有办法将内容保留在选项卡旁边?
<div class="container-fluid">
<div class="row">
<div class="col-md-2">
<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
<a class="nav-link active" id="v-pills-home-tab" data-toggle="pill" href="#v-pills-home" role="tab" aria-controls="v-pills-home" aria-selected="true">Home</a>
<a class="nav-link" id="v-pills-profile-tab" data-toggle="pill" href="#v-pills-profile" role="tab" aria-controls="v-pills-profile" aria-selected="false">Profile</a>
<a class="nav-link" id="v-pills-messages-tab" data-toggle="pill" href="#v-pills-messages" role="tab" aria-controls="v-pills-messages" aria-selected="false">Messages</a>
<a class="nav-link" id="v-pills-settings-tab" data-toggle="pill" href="#v-pills-settings" role="tab" aria-controls="v-pills-settings" aria-selected="false">Settings</a>
</div>
</div>
<div class="col-md-10">
<div class="tab-content" id="v-pills-tabContent">
<div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab"> …Run Code Online (Sandbox Code Playgroud) 当用户完成输入、计时器基本完成时,我需要运行一些东西。当用户键入时计时器将被重置,但一旦时间结束,它将根据用户键入的次数运行该函数
export default function SearchMovie() {
var keyUpTimer = 0;
const keyUpTimerDelay = 2000;
const handleOnKeyUp = (event) => {
clearTimeout(keyUpTimer);
keyUpTimer = setTimeout(() => {
console.log(input);
}, keyUpTimerDelay);
};
return (
<div className="search-container">
<input
type="text"
className="input-text"
onInput={(e) => setInput(e.target.value)}
onKeyUp={handleOnKeyUp}
placeholder="Type a movie to search..."
/>
</div>
);
}
Run Code Online (Sandbox Code Playgroud) claims.Add(new Claim(ClaimTypes.Role, string.Join(",", user.UserRoles.Select(ur => ur.Role.Nome))));
Run Code Online (Sandbox Code Playgroud)
但是如果我这样做
User.IsInRole("myRole")
Run Code Online (Sandbox Code Playgroud)
它返回 false
我有大约 40 个实体,每次编译并运行我的应用程序后,第一次调用 DbContext 都会花费近 10 秒的时间。有没有办法让它运行得更快?
\n\n这是当用户已经登录我的应用程序时我在第一次通话时所做的事情
\n\n页面模型
\n\npublic class CreateModel : PageModel\n{\n private readonly IToastNotification _toastNotification;\n private readonly ICelulaService _celulaService;\n\n public CreateModel(IToastNotification toastNotification, ICelulaService celulaService)\n {\n _toastNotification = toastNotification;\n _celulaService = celulaService;\n }\n\n public IList<Celula> Celulas { get; set; }\n\n public void OnGet()\n {\n Celulas = _celulaService.GetAutomated();\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n\n服务与接口
\n\npublic interface ICelulaService\n{\n IList<Celula> GetAutomated();\n}\n\npublic IList<Celula> GetAutomated()\n{\n return _context.Celulas\n .Where(c => c.Automated)\n .ToList();\n}\nRun Code Online (Sandbox Code Playgroud)\n\n该模型
\n\n[Table("hCelulas")]\npublic class Celula\n{\n public int Id { get; …Run Code Online (Sandbox Code Playgroud) 我在控制器上有这 2 个操作
\n\n[HttpPost]\n [ValidateAntiForgeryToken]\n public IActionResult AddComDefeito(PecaRegisto pecaRegisto)\n {\n if (!ModelState.IsValid)\n {\n return PartialView("_AddComDefeitoPartial", pecaRegisto);\n }\n\n return PartialView("_AddComDefeitoPartial", new PecaRegisto());\n }\n\n [HttpPost]\n [ValidateAntiForgeryToken]\n public IActionResult AddSemDefeito(PecaRegisto pecaRegisto)\n {\n if (!ModelState.IsValid)\n {\n return PartialView("_AddSemDefeitoPartial", pecaRegisto);\n }\n\n return PartialView("_AddSemDefeitoPartial", new PecaRegisto());\n }\nRun Code Online (Sandbox Code Playgroud)\n\n这是模型
\n\npublic class PecaRegisto\n{\n public int Id { get; set; }\n\n [Required]\n [Range(1, int.MaxValue)]\n public int Quantidade { get; set; }\n [Required]\n [Display(Name = "Refer\xc3\xaancia")]\n public int ReferenciaId { get; set; }\n public Referencia Referencia { …Run Code Online (Sandbox Code Playgroud) 我已经设置了一个要在此时运行的重复作业,但我想在另外 2 个特定时间重复它。我该怎么做?
app.UseHangfireDashboard();
RecurringJob.AddOrUpdate<TerminaTurnos>(t => t.Termina(), Cron.Daily(22, 10), TimeZoneInfo.Local);
Run Code Online (Sandbox Code Playgroud) 我想使用一条CASE语句在SQL Server中设置一个变量。例如:
DECLARE @UNITY VARCHAR(5)
DECLARE @AUX VARCHAR(5)
CASE
WHEN @UNITY = 'U1' THEN @AUX = 'M1'
WHEN @UNITY = 'U2' THEN @AUX = 'M2'
WHEN @UNITY = 'U3' THEN @AUX = 'M3'
END
Run Code Online (Sandbox Code Playgroud) c# ×6
asp.net-core ×4
javascript ×2
axios ×1
hangfire ×1
html ×1
reactjs ×1
sql-server ×1
t-sql ×1
validation ×1
vuejs2 ×1