Beispiel #1
0
        public async Task <IActionResult> Create([Bind("Id,Status,Name,Contacts")] Employers employers)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employers);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employers));
        }
        public async Task <IActionResult> Create([Bind("Id,Status,Name,Contacts,EmployerId")] Workers workers)
        {
            if (ModelState.IsValid)
            {
                _context.Add(workers);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployerId"] = new SelectList(_context.Employers, "Id", "Contacts", workers.EmployerId);
            return(View(workers));
        }