В Get: // GET: public IActionResult Create () {
ViewData["Tags"] = new SelectList(_context.Tags, "Id", "Name");
return View();
}
In Post: var selectedIds = Request.Form ["Теги"];
В представлении :
<label>Tags</label>
<select asp-for="Tags" id="Tags" name="Tags" class="form-control" asp-items="ViewBag.Tags" multiple></select>