Beispiel #1
0
        public async Task <IActionResult> Create([Bind("EmployeeId,Firstname,Lastname")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
        public async Task <IActionResult> Create([Bind("AlertId,EmployeeId,Alert")] EmployeeAlert employeeAlert)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employeeAlert);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeId"] = new SelectList(_context.Employee, "EmployeeId", "Firstname", employeeAlert.EmployeeId);
            return(View(employeeAlert));
        }