public async Task <IActionResult> Create([Bind("EmployeeId,Name,Department,Title")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("TaskId,Title,Type,Details,Status,Priority,DueDate,EmployeeForeignKey")] Models.Task task)
        {
            if (ModelState.IsValid)
            {
                _context.Add(task);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeForeignKey"] = new SelectList(_context.Employees, "EmployeeId", "Name", task.EmployeeForeignKey);
            return(View(task));
        }