Ejemplo n.º 1
0
        public async Task <IActionResult> EditEmployee(EditingEmployeeModel empModel)
        {
            if (await employeeRepo.UserIsAdmin())
            {
                await employeeRepo.EditEmployee(empModel);

                return(RedirectToAction("ShowEmployees"));
            }
            else
            {
                return(await AccessDeniedView());
            }
        }
Ejemplo n.º 2
0
        public async Task EditEmployee(EditingEmployeeModel employeeModel)
        {
            //fix client
            var client = context.Clients.First(p => p.CompanyName == employeeModel.ClientName);

            employeeModel.ClientId = client.ClientId;

            var databaseEmployee = await context.Employees.SingleAsync(p => p.Id == employeeModel.EmployeeId);

            var      role          = 0;
            DateTime startdaterole = DateTime.MinValue;

            if (employeeModel.RoleAsString == "Admin")
            {
                role          = 1;
                startdaterole = DateTime.Now;
            }
            else if (employeeModel.RoleAsString == "Medewerker")
            {
                role          = 2;
                startdaterole = DateTime.Now;
            }
            else if (employeeModel.RoleAsString == "Trainee")
            {
                role          = 3;
                startdaterole = DateTime.Now;
            }
            else if (employeeModel.RoleAsString == "Inactief")
            {
                role          = 4;
                startdaterole = DateTime.Now;
            }

            databaseEmployee.ClientId      = employeeModel.ClientId;
            databaseEmployee.FirstName     = employeeModel.FirstName;
            databaseEmployee.LastName      = employeeModel.LastName;
            databaseEmployee.Email         = employeeModel.Email;
            databaseEmployee.Address       = employeeModel.Address;
            databaseEmployee.PhoneNumber   = employeeModel.Phone;
            databaseEmployee.Role          = role;
            databaseEmployee.ZIPCode       = employeeModel.ZIPCode;
            databaseEmployee.Residence     = employeeModel.Residence;
            databaseEmployee.StartDateRole = startdaterole;

            await context.SaveChangesAsync();
        }
Ejemplo n.º 3
0
 public Task EditEmployee(EditingEmployeeModel employeeModel)
 {
     return(null);
 }