public async Task <IActionResult> Create([Bind("Id,Name,City,Department,Salary")] Employees employees)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employees);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employees));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("employeeNumber,employeeName,age,ove18,education,educationField,gender,distanceFromHome,workLifeBalace,maritalStatus,overTime,businessTravel,numCompaniesWorked,attrition,department,dailyRate,empCount,hourlyRate,standardHours,jobInvolvement,jobLevel,jobRole,monthlyIncome,monthlyRate,percentageSalaryHike,performanceRating,environmentSatisfaction,stockOptionlevel,relationshipSatisfaction,totalWorkingYears,traningTimesLastYear,traningAtCompany,yearsInCurrentRole,yearsSinceLastpromotion,yearsWithCurrentManager")] 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,FirstName,LastName,Address,NettoSallary")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
 public async Task <IActionResult> CreateOrUpdate([Bind] Employee emp)
 {
     if (ModelState.IsValid)
     {
         if (emp.EmployeeId == 0)
         {
             Empcontext.Add(emp);
         }
         else
         {
             Empcontext.Update(emp);
         }
         await Empcontext.SaveChangesAsync();
     }
     return(RedirectToAction("Index"));
 }