Exemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("id,DepartmentName")] Departments departments)
        {
            if (ModelState.IsValid)
            {
                _context.Add(departments);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(departments));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("id,FName,LName,Phone,Address,City,State,Zipcode,DepartmentID")] Employees employees)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employees);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DepartmentID"] = new SelectList(_context.Departments, "id", "DepartmentName", employees.DepartmentID);
            return(View(employees));
        }