public async Task <IActionResult> Create([Bind("empid,name,city")] emp emp)
        {
            if (ModelState.IsValid)
            {
                _context.Add(emp);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(emp));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("firstName,middleName,lastName,birthDate,hireDate,department,jobTitle,salary,salaryType,ID,availableHours")] employeeModel employeeModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employeeModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employeeModel));
        }
        public async Task <IActionResult> AddOrEdit([Bind("EmployeeId,FullName,EMPCode,Position,OfficeLocation")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }