public async Task <IActionResult> Create([Bind("Id,WorkId,UserId")] Work_User work_User) { if (ModelState.IsValid) { _context.Add(work_User); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["WorkId"] = new SelectList(_context.Works, "Id", "Id", work_User.WorkId); return(View(work_User)); }
public async Task <IActionResult> Create([Bind("Id,SurName,Name,Patronymic,UserId")] Admin admin) { if (ModelState.IsValid) { _context.Add(admin); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["UserId"] = new SelectList(_context.Users, "Id", "Id", admin.UserId); return(View(admin)); }