我有创建控制器,在其中创建数据库条目
这是代码
summary(iris_kmeans)
但是对于属性[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create(
[Bind("Title", "Date", "WorkTime", "Quantity", "ServiceId", "Price", "ProjectId", "WorkTimeTo", "CreatingDate", "WorkDoneFrom", "WorkDoneTo",
"BreakFrom", "BreakTo")]
Proposals proposal)
{
if (ModelState.IsValid)
{
_context.Proposals.Add(proposal);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
ViewData["ServiceId"] = new SelectList(_context.Services, "Id", "Name",proposal.ServiceId);
ViewData["ProjectId"] = new SelectList(_context.Projects, "Id", "Name", proposal.ProjectId);
return View(proposal);
}
,我需要设置DateTime.now的值。如何将其正确应用于财产?