Exemple #1
0
        public async Task <IActionResult> Create([Bind("EmpNumber,MaritalStatus,Age,Over18,NumCompaniesWorked,NumWorkingYears,DistanceFromHome,Education,EducationField,Gender")] PrimaryTable primaryTable)
        {
            if (ModelState.IsValid)
            {
                _context.Add(primaryTable);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(primaryTable));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("EmpNumber,EnvironmentSat,JobSat,RelationshipSat,WorkLifeBalance,EmpId")] EmployeePerf employeePerf)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employeePerf);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmpNumber"] = new SelectList(_context.PrimaryTables, "EmpNumber", "EmpNumber", employeePerf.EmpNumber);
            return(View(employeePerf));
        }
        public async Task <IActionResult> Create([Bind("EmpNumber,HourlyRate,MonthlyRate,DailyRate,RatesId")] Rate rate)
        {
            if (ModelState.IsValid)
            {
                _context.Add(rate);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmpNumber"] = new SelectList(_context.PrimaryTables, "EmpNumber", "EmpNumber", rate.EmpNumber);
            return(View(rate));
        }
Exemple #4
0
        public async Task <IActionResult> Create([Bind("EmpNumber,Attrition,BusinessTravel,Department,EmployeeCount,JobInvolvement,JobLevel,JobRole,Overtime,StandardHours,StockOptionLevel,YearsLastPromotion,YearsCurrentRole,YearsCurrentManager,YearsAtCompany,JobDetailsId")] Jobdetail jobdetail)
        {
            if (ModelState.IsValid)
            {
                _context.Add(jobdetail);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmpNumber"] = new SelectList(_context.PrimaryTables, "EmpNumber", "EmpNumber", jobdetail.EmpNumber);
            return(View(jobdetail));
        }
        public async Task <IActionResult> Create([Bind("EmpNumber,MonthlyIncome,PercentSalaryHike,SalaryId")] Salary salary)
        {
            if (ModelState.IsValid)
            {
                _context.Add(salary);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmpNumber"] = new SelectList(_context.PrimaryTables, "EmpNumber", "EmpNumber", salary.EmpNumber);
            return(View(salary));
        }
        public async Task <IActionResult> Create([Bind("EmpNumber,PerformanceRating,TrainingTimesLastYear,RatingId")] ManagerRating managerRating)
        {
            if (ModelState.IsValid)
            {
                _context.Add(managerRating);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmpNumber"] = new SelectList(_context.PrimaryTables, "EmpNumber", "EmpNumber", managerRating.EmpNumber);
            return(View(managerRating));
        }
Exemple #7
0
        public async Task <IActionResult> Create(UserManagementCreate model)
        {
            if (ModelState.IsValid)
            {
                var passwordSalt = Guid.NewGuid().ToString(); //Random Password Salt is created
                var user         = new Login()
                {
                    NameUser     = model.NameUser,
                    SurnameUser  = model.SurnameUser,
                    UserEmail    = model.UserEmail,
                    Passwordsalt = passwordSalt,
                    Passwordhash = _cryptography.PassWordHashing(model.Passwordhash + passwordSalt), //Hashes the password before inserting into DB and also assignes passwordSalt
                    UserRole     = "User",                                                           // User role can be changed by an admin user to "Admin" to give a user admin privilages
                    Id           = random_id(),                                                      //Creates a random id
                    EmpNum       = int.Parse(model.EmpNum),
                };

                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(model));
        }