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

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
        public async Task <IActionResult> Create([Bind("ID,fname,lname,StartDate,benefit_enrolled,Dependents,YearsEmployed")] GetEmployeeSummary_Result getEmployeeSummary_Result)
        {
            if (ModelState.IsValid)
            {
                _context.Add(getEmployeeSummary_Result);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(getEmployeeSummary_Result));
        }
        public async Task <IActionResult> Create([Bind("ID,fname,lname,dcode,employeeID")] Dependent dependent)
        {
            if (ModelState.IsValid)
            {
                int id = _context.Employee.FirstOrDefault().ID;
                dependent.employeeID = id;
                _context.Add(dependent);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Details), "Employees", new { ID = id }));
            }
            ViewData["employeeID"] = new SelectList(_context.Employee, "ID", "ID", dependent.employeeID);
            return(View(dependent));
        }